microsoft / microsoft/TypeScript
Intersection type intellisense duplicates jsdoc, rather than overriding
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
- VSCode Version: 1.33.1
- OS Version: macOS 10.12.6
Does this issue occur when all extensions are disabled?: Yes
Sorry if the title isn't clear, it's tricky to put into words but obvious with code. The gist is when a type is extended and has the same key, the intellisense combines the documentation, rather than the "child" overriding it, like they do with interface. It's easier to explain with an example.
When intersecting types with the same property, the intellisense documentation shows all of the comments instead of just the latest:
type Duck {
/** This is a really great duck */
id: string
}
type Mallard = Duck & {
/** I love this duck */
id: string
}
const duckMan: Mallard = {
id // intellisense here shows "This is a really great duck I love this duck"
}
However, with an interface, the intellisense shows only the direct type comment, which is expected.
interface Duck {
/** This is a really great banana */
id: string
}
interface Mallard extends Duck {
/** I love this duck */
id: string
}
const duckMan: Mallard = {
id // Intellisense says "I love this duck"
}
I found this out because I'm using graphql-codegen to generate types for my GraphQL schema. It generates types, and the intellisense in some cases repeats many times.
Expectation
I would expect the "closest" comment doc of a type to override all of the others, like it does with an interface. If there's a reason that can't work, then at least having a uniqueness check would be good, maybe new Set(typedocs))
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ソースファイルもテストも指定されていません。まず、提供された intersection type と interface の例を TypeScript IntelliSense で再現し、次に language-service における交差されたプロパティの JSDoc の処理を追跡します。最も近い型のドキュメントが、継承されたコメントを重複させずに表示されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers, developer-experience
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100