Microsoft/TypeScript

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

Open

#57.442 aperta il 19 feb 2024

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)TypeScript (6726 fork)batch import
Domain: flag: isolatedDeclarationsHelp WantedPossible Improvement

Metriche repository

Star
 (48.455 star)
Metriche merge PR
 (Merge medio 6g 17h) (9 PR mergiate in 30 g)

Descrizione

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

Guida contributor