Show deprecated strikethrough for JSX properties when union type
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- tooling
調査の方向性
まず issue #50079 と fix #50084 を確認してください。これらでは、完全に非推奨となった JSX プロパティの取り消し線処理が確立されています。共用体プロパティ型に対する既存の JSX の非推奨動作を追跡し、エディターがプロパティに取り消し線を付けるかどうかをどのように判断しているかを特定してください。非推奨の共用体値では対応する視覚的な取り消し線動作が発生し、非推奨でない値では発生しなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
🔍 Search Terms
"strikethrough deprecated prop jsx", "strikethrough deprecated prop react", "strikethrough deprecated property jsx", "strikethrough deprecated property react", "deprecated property react", "deprecated property jsx"
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
I came across #50079 and the fix #50084 which works nicely when the whole property is deprecated. However it's also possible to create a type like the following:
{
myProp: 'a' | 'b' | 'c'
} | {
/** @deprecated use 'a' | 'b' | 'c' */
myProp: 1 | 2 | 3
}
This still correctly shows the deprecated message when hovered over the property in JSX when the value of the property is 1, 2, or 3, and not when the value is 'a', 'b' or 'c'. However the property is never shown with a strikethrough. It would be fantastic if the strikethrough on the property could match the deprecated message behaviour in the hover pop over.
📃 Motivating Example
TypeScript has now extended deprecation checking in JSX to visually add a strikethrough to a property when the property is still valid, but a deprecated value for the property is used (see example in the suggestion above).
💻 Use Cases
- What do you want to use this for?
When transitioning a React component's property to a new set of values it would be useful to maintain the old values for backwards compatibility but deprecate them to visually indicate to a user that they should no longer be using them. My specific use case is when the original values were less explicit:
size: 'classname-small' | 'classname-medium' | 'classname-large'
and I'm transitioning the new type to be:
size: 's' | 'm' | 'l'
and would like to support both types in the interim, but notify uses explicitly to use the new values.
2. What shortcomings exist with current approaches?
There is no visual indication that the value is deprecated without hovering over the property
3. What workarounds are you using in the meantime?
It's not possible to workaround. Just have to deal with it only being in the pop up
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/TypeScript のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
microsoft/TypeScript#64322 · コメント 2 件 · リアクション 1 件 · 担当者 2 名 ·
-
Possible Improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/TypeScript#64278 · コメント 1 件 · リアクション 1 件 ·
-
Docs
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
microsoft/TypeScript#64118 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
microsoft/TypeScript#64094 ·
-
Docs
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/TypeScript#63959 · コメント 5 件 ·
microsoft/TypeScript の issue をすべて見る
似ている issue
-
optimization optimization:agents-md-curator
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
githubnext/gh-aw-cao#13143 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
blinklabs-io/bursa#904 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · コメント 2 件 ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100