Preserve comments with object destructuring assignment
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- typescript
- 領域
- compilers
調査の方向性
リンクされた TypeScript Playground での動作を再現し、直接アクセスされるプロパティと object destructuring によって導入される変数のホバーツールチップを比較します。destructured bindings のコメントを解決する language-service/type-checking の経路を追跡します。x、y、および destructured function parameters に対して宣言されたプロパティのコメントが表示され、runtime output が変わらなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
Search Terms
object destructuring assignment, comment
Suggestion
interface MyInterface {
/**
* I am x
*/
x : number;
/**
* I am y
*/
y : number;
}
declare const myInterface : MyInterface;
const {x, y} = myInterface;
/**
* Expected tooltip to have comment,
* > I am x
*
* Actual: No comment
*/
x;
/**
* Expected tooltip to have comment,
* > I am y
*
* Actual: No comment
*/
y;
/**
* Expected tooltip to have comment,
* > I am x
*
* Actual:
* Tooltip has comment,
* > I am x
*/
myInterface.x;
/**
* Expected tooltip to have comment,
* > I am y
*
* Actual:
* Tooltip has comment,
* > I am y
*/
myInterface.y;
/**
* I am z
*/
const z = 1;
/**
* Expected tooltip to have comment,
* > I am z
*
* Actual:
* Tooltip has comment,
* > I am z
*/
z;
Use Cases
I came across this idea after writing code like this,
function foo (
{
somePropertyA,
somePropertyB,
somePropertyC,
} : SomeObject
) {
/* Use these properties */
}
And I was hazy on the details of what each property was for.
So, I hovered my cursor over the variables somePropertyA, somePropertyB, somePropertyC and noticed there were no comments.
I had to go to the declaration of somePropertyA, somePropertyB, somePropertyC and look at each property individually.
At the moment, the way to get comments is to just do,
function foo (
o : SomeObject
) {
/* Use these properties */
}
Then the tooltip for o.somePropertyA, o.somePropertyB, o.somePropertyC will have comments
Examples
See above suggestion
Checklist
My suggestion meets these guidelines:
- 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, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 106
コントリビューションガイド
はじめの一歩
- 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
-
Type/Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenNSW/nsw-srilanka#497 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
milvus-io/birdwatcher#545 ·
-
kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
kubernetes-sigs/prow#953 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
JuliusBrussee/caveman#1102 · コメント 1 件 ·