microsoft / microsoft/TypeScript
Comment directive activated when longer string used
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
TypeScript Version: typescript@4.0.0-dev.20200526
NodeJS Version: v12.16.2
Visual Studio Code:
Version: 1.45.1 (system setup)
Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a
Date: 2020-05-14T08:27:35.169Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 6.1.7601
Search Terms: comment directive, @ts-ignore
Code
let obj = { }
// @ts-ignoreThisShouldNotMatchButItDoes
console.log( `obj.a = ${obj.a}` )
Expected behavior:
Property 'a' does not exist on type 'object'.ts(2339)
Actual behavior:
compile time: no 2339 error or indication in VS Code
run time: obj.a = undefined
Description
Visual Studio code and running tsc will produce error 2339 when the comment directive is removed. When adding in the comment // @ts-ignore both Visual Studio code and tsc will ignore the error. However, misspelling ts-ignore as ts-ignoree or ts-ignoreThisShouldNotMatchButItDoes will invoke the @ts-ignore directive and ignore the error.
I didn't test other directives to see whether they had similar issues... trying to keep things simple, but this issue could be symptomatic of all comment directives, assuming they re-use the same code for parsing.
Related Issues: None that I could find. Searched under @ts-ignore, comment directive
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
issue のコードサンプルと Playground リンクに示されている TypeScript コンパイラーの動作を、報告されている TypeScript 4.0.0-dev.20200526 のセットアップで確認することから始めます。// @ts-ignoreThisShouldNotMatchButItDoes のケースを tsc で再現し、正しく記述されたディレクティブおよびスペルミスのあるバリエーションと比較します。完了条件は、正確なコメントディレクティブだけがエラー 2339 を抑制し、より長い文字列では抑制されないことです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100