microsoft / microsoft/TypeScript

When using typeof for the interface, it is hoped that the jsdoc comments of the expression can inherit typeof by default

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

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

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

説明

🔍 Search Terms

"typeof","jsdoc"

✅ Viability Checklist
⭐ Suggestion
/** JSDoc1 */
const test = { a: 0 }

declare module 'vue' {
  interface ComponentCustomProperties {
    /** JSDoc2 */
    testInInterface: typeof test,
  }
}

const test2 = {
  /** JSDoc3 */
  test
}

I hope that when not writing JSDoc2 or JSDoc3, testInInterface and test2.test can have comments for const test in JSDoc1

📃 Motivating Example

The interface has the feature of declaring and merging, allowing developers to extend the interfaces defined in the component library. In front-end development, extending Vue's global components, directives, and properties is often used.

Taking a Vue component as an example, including its global and local usage schemes, there is currently a lack of JSDoc comments

  • global
import vueComponentWithJsDoc from './test.vue'

declare module 'vue' {
  interface GlobalComponents {
    vueComponentWithoutJsDoc: typeof vueComponentWithJsDoc
  }
}
  • local
import vueComponentWithJsDoc from './test.vue'
import { defineComponent } from 'vue'

export default defineComponent({
  components: { vueComponentWithoutJsDoc: vueComponentWithJsDoc  }
})

When using components in the template, both of the above schemes lack JSDoc comments

<template>
  <vue-component-without-js-doc />
</template>
💻 Use Cases
  1. JSDoc comments can be included when declaring a merge interface
  2. The type obtained by the typeof instance is missing the jsdoc annotation
  3. Manually copy a jsdoc comment onto the interface field

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

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

はじめの一歩

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

調査の方向性

test で JSDoc1 を使用して例を再現し、その後 testInInterfacetest2.test に不足しているコメントを比較します。typeof 式のコメントが、JSDoc2 や JSDoc3 を必要とせず、インターフェースの場合とプロパティアクセスの場合の両方で継承されるようになれば、変更は完了です。

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

評価

技術スタック
javascript, typescript
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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