Cannot import properties from module.exports as types in JSDoc
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- javascript, typescript
- 領域
- compilers
調査の方向性
まず、TypeScript の JSDoc チェックを有効にして a.js と b.js の例を実行します。import('./a') の型と module.exports の処理を確認し、その後、単一エクスポートの動作を変更せずに、A プロパティがコンストラクターのパラメーター型として認識されることを検証します。この再現で報告されたエラーがなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
TypeScript Version: 3.3.0-dev.20190118
Search Terms: jsdoc import module.exports has no exported member
Code
a.js
class A {}
module.exports = {A}
b.js
// @ts-check
class B {
// In the JSDoc below, VSCode intellisense does not recognize parameter a as type A.
// Instead it shows the error:
// Namespace '".../a".export=' has no exported member 'A'
/**
* @param {import('./a').A} a
*/
constructor (a) {
this.a = a
}
}
Expected behavior
Parameter a of the constructor should be recognized as type A, which is accessible via the A property of module.exports from a.js.
Actual behavior
Intellisense reports the error: Namespace '".../a".export=' has no exported member 'A'.
Notes
@param {import('./a')} a does not give an error, but it resolves to type {A: typeof A} instead of A.
If a.js is modified with module.exports = A, then import('./a') resolves to A, however this restricts a.js to only exporting one type.
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
コントリビューションガイド
はじめの一歩
- 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
-
optimization optimization:agents-md-curator
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
githubnext/gh-aw-cao#13143 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
blinklabs-io/bursa#904 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · コメント 2 件 ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100