Microsoft/TypeScript

[ID-Prep] Explicit type annotation of const replaced with initializer in declaration emit

オープン

#57,442 opened on 2024/02/19

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (13,395 件のフォーク)batch import
Domain: flag: isolatedDeclarationsHelp WantedPossible Improvement

Repository metrics

Stars
 (108,860 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 9 merged PRs)

説明

The [ID-prep] set of issues aligns Declaration Emit with the forthcoming Isolated Declarations feature.

🔎 Search Terms

declarations type annotation const not preserved

🕗 Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Playground Link

💻 Code

enum E { "some value" = 1 };
const e: typeof E["some value"] = E["some value"];

🙁 Actual behavior

e is emitted in declarations as declare const e = E["some value"];

🙂 Expected behavior

e should have in declarations the type that was manually declared

Additional information about the issue

No response

コントリビューターガイド