microsoft / microsoft/TypeScript
Extend JSDoc @this to JavaScript class - apply @this to every non-static method
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Let a node.js JavaScript (cjs) module:
// global .d.ts
declare class FooTS { tsProp: string; }
// xxx.js
// Goal: let intellisense treat class Foo's 'this' to fake class FooTS
// /** @this {FooTS} */ => currently this is invalid
class Foo {
/** @this {FooTS} */
constructor() { this.jsProp = 123; };
/** @this {FooTS} */
bar() { return this.tsProp; }
}
@this works for class methods, but it is verbose to add @this to every method.
It would be a QoL improvement to allow @this apply to JavaScript class with the effect that it apply @this to every non-static method.
This is probably invalid in original JSDoc, and doesn't make much sense.
But in vscode, it makes sense because user can use Typescript .d.ts for (more powerful and less verbose) type declaration for JavaScript implementation.
Alternatively, a more aggressive QoL could be that introduce a new tag to treat Foo type as FooTS type globally.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue では実装ファイル、テスト、エントリポイントのいずれも指定されていません。まず、TypeScript に既存する JSDoc の @this 処理と JavaScript のクラスメソッドに対するチェックを見つけ、次に関連するテストを確認してください。クラスレベルの @this によって、メソッドごとに注釈を繰り返し付けなくても、すべての非 static メソッドに this 型を提供できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js, typescript
- 領域
- compilers, developer-experience
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100