microsoft / microsoft/TypeScript
Including full error range in TSC output
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
From https://github.com/Microsoft/vscode/issues/70465
Repo
-
For the TS code with
strictenabled:const obj = { prop: Date.now() ? 'str' : undefined } obj.prop.toLowerCase(); -
Run a tsc task in VS Code to see reported errors (make sure to close the ts file as well)
Problem
We currently only report the potential undefined access error on obj in the line obj.prop.toLowerCase();. The correct range should span obj.prop.
The root cause of this is that VS Code's problem matcher does not have the full range of the error from tsc, only the start line and column. Here's the tsc output:
src/index.ts:7:1 - error TS2532: Object is possibly 'undefined'.
7 obj.prop.toLowerCase();
~~~~~~~~
With the current tsc output, there is also no way to extract the full range of the error.
Request
Somewhere in the line src/index.ts:7:1 - error TS2532: Object is possibly 'undefined'.
, add the end position as well so that tooling can properly highlight it. We would want to do this in a way that doesn't detract from the error's human readability. This needs some thought
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された strict な TypeScript の例で問題を再現し、tsc の診断出力で TS2532 を調べます。人間にとっての可読性を低下させずに診断の終了位置を含める方法を決定します。ツールで範囲全体を抽出でき、既存のエラーも理解可能なままになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100