microsoft / microsoft/TypeScript

Extract to function in upper scope

オープン
#40,723 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Awaiting More Feedback Domain: LS: Refactorings Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

We have Extract to function in module scope and Extract to inner function in function xxx(which is Extract to function in current scope), we should also have Extract to function in upper scope. With it, we can:

const g = 'g';
export function A() {
  const a_local = 'a';
  return function B() {
    const b_local = 'b';
    return function C() {
      const c_local = 'c';
      // the bottom will be extracted to function upper scope
      console.log(g, a_local, b_local, c_local);
      // the above will be extracted to function upper scope
    }
  }
}

After the extraction, code will be:

const g = 'g';
export function A() {
  const a_local = 'a';
  return function B() {
    const b_local = 'b';
    function newFunction(c_local: string) {
      console.log(g, a_local, b_local, c_local);
    }
    return function C() {
      const c_local = 'c';
      newFunction(c_local);
    }
  }
}

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、「Extract to function in module scope」と「Extract to function in current scope」の実装とテストを見つけます。既存のリファクタリング動作を拡張し、より上位の関数スコープを抽出先に指定できるようにするとともに、より深いスコープの変数をパラメーターとして渡せるようにし、TypeScript の例に対応するカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
developer-experience, tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。