microsoft / microsoft/TypeScript

Detect Typescript in Javascript editors opened and inform developer, that he is writing different syntax and it will silently fail (probably)

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

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

Needs More Info
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

It would be super helpful to have something like:

Warning: TypeScript syntax detected in .jsx file. 
Would you like to:
[ ] Rename to .tsx
[ ] Remove TypeScript syntax
[ ] Ignore warning

This kind of UX improvement could save developers (especially those transitioning between JS and TS projects) a lot of time and frustration. It seems like a relatively straightforward detection that could help a lot of people!

VSCode already does similar helpful suggestions for other cases (like offering to create files that don't exist when you import them), so this would fit right in with that philosophy.

What it would solve?

It's the classic .jsx vs .tsx gotcha! 😄

This is such a common issue that even experienced developers run into it regularly. The file extension makes all the difference because:

  • .jsx files are treated as regular JavaScript/React files
  • .tsx files are treated as TypeScript/React files

So TypeScript typing just "silently fails" to work in .jsx files without any obvious error message about why the types aren't working.

It's one of those "spend an hour debugging only to realize it's a file extension" moments that every developer has experienced!

  • .CJS -> .TS, .JS -> .TS, .JSX -> .TSX

(Similar functionality could be created for CSS -> SCSS, ... .)

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

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

はじめの一歩

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

調査の方向性

この Issue ではファイル、テスト、エントリーポイントが指定されていません。まず、エディターの診断または言語サービスの提案が実装されている場所を特定し、次に構文検出と、名前変更・削除・無視のアクションをどのように組み込めるかを判断してください。完了とは、提案した警告が指定された拡張子で機能し、有効な JavaScript を妨げないことです。

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

評価

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

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

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