microsoft / microsoft/TypeScript
Smarter errors around `Function.length`
オープン
まだ誰も着手していません。
Domain: Error Messages
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
I don't know how often other people have encountered this, but here goes: In the same vein as our uncalled function checks, most usages of Function.length are probably an error. Here's a toy example that just bit me:
declare function getResult(): string[];
for (let i = 0; i< getResult.length; i++) {
getResult().slice(0, i).map(x => console.log(x));
}
Minimally, I think we could suggest that if a function returns something with a length property, and the function's length property is inspected instead, we could probably mark it as suspect.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、TypeScript コンパイラーに既にある未呼び出し関数のチェックを調べ、次に関数プロパティへのアクセスがどのように解析されるかを追跡します。関数の結果が length プロパティを持つ場合に Function.length を検査する際の意図された診断上の境界を定義し、その使用が疑わしいと見なされる条件を示すカバレッジを追加します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100