microsoft / microsoft/TypeScript

Correct declaration emit of commonjs exports of namespace-nested classes

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

@sandersn がすでに取り組んでいます。

2020年9月10日 から。

Bug Domain: Declaration Emit
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

Followup to #40228:

var NS = {}
NS.K =class {
    values() {
        return new NS.K()
    }
}
exports.K = NS.K;

Expected behavior:

Should produce d.ts output:

declare namespace NS {
    class _K {
      values(): _K;
    }
    export {_K as K};
}
import _K = NS.K;
export {_K as K};

Actual behavior:

export var K: {
    new (): {
        values(): any;
    };
};
  1. Inlines and destroys the namespace.
  2. Only exports a value, not a class.
  3. Doesn't serialise nested typed references to K properly.

The declaration emitter just needs code to support this; right now it's hitting inaccurate fallback code.

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

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

はじめの一歩

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

評価

この issue はまだ評価されていません。

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

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