microsoft / microsoft/TypeScript
TSX error location error with location and JSX comment
オープン
まだ誰も着手していません。
Bug
Domain: JSX/TSX
Needs Human Review
Needs More Info
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
🔎 Search Terms
TSX JSX error location comments
🕗 Version & Regression Information
- This changed between versions 4.9.5 and 5.0.4.
In TS4 the error was created on the wrapping element instead, which prevents the issue occurring.
⏯ Playground Link
💻 Code
export class Component {
// Error message for {location} is shown on {/* */} instead
// Type 'Location' is not assignable to type 'ReactNode'.(2322)
content = () =>
<div>
{/* */}
{location}
<br />
</div>
// These similar versions are all fine
content2 = () =>
<div>
{/* */}
{x}
<br />
</div>
content3 = () =>
<div>
{location}
<br />
</div>
content4 = () =>
<div>
{/* */}
{location}
</div>
content5 = () =>
<div>
<br />
{location}
{/* */}
</div>
}
🙁 Actual behavior
The red squiggly is shown on the {/* */} instead of {location} in the first example.
🙂 Expected behavior
The red squiggly should be shown on {location}.
Additional information about the issue
Just a minor issue.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされている TypeScript Playground の再現例から始め、コンパイラーがコメントと {location} を含む JSX の子要素に診断範囲をどのように割り当てるかを調べます。JSX の診断位置を追跡し、その後この例の回帰テストを追加して、エラーが JSX コメントではなく {location} に対して報告されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 55/100