Microsoft/TypeScript

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

Open

#57,442 创建于 2024年2月19日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)TypeScript (6,726 fork)batch import
Domain: flag: isolatedDeclarationsHelp WantedPossible Improvement

仓库指标

Star
 (48,455 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 9 个 PR)

描述

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

贡献者指南