microsoft / microsoft/TypeScript

Display inlay hints with defining variables by destructuring assignment

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

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

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

説明

🔍 Search Terms

inlay hints
vscode
destructuring assignment

✅ 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 feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion

In the following example, inlay hints are not shown in VSCode.

const [value, setValue] = useState("");

I hope inlay hints will look like this.

const [value /*: string */, setValue /*: React.Dispatch<React.SetStateAction<string>> */] = useState("");
📃 Motivating Example

It allows you to know the type without hovering, improving development efficiency.

💻 Use Cases
  1. What do you want to use this for?
    I want to display inlay hints with defining variables by destructuring assignment in VSCode.
  2. What shortcomings exist with current approaches?
    I can't know the inference types without hovering.
  3. What workarounds are you using in the meantime?
    I hover and look at the types.

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

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

はじめの一歩

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

調査の方向性

TypeScript のインレイヒント実装とその VSCode 統合から始め、issue にある分割代入の例を再現ケースとして使用します。分割代入された各変数の推論された型がどのように表現されるかを確認し、そのうえで、出力される JavaScript を変更せずに value と setValue の両方にヒントが表示されることを検証します。

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

評価

技術スタック
typescript, vscode
領域
developer-experience, tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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