Microsoft/TypeScript

[ID] `--isolatedDeclarations` disallows `const` initialized with a regex literal

開放

#58,383 建立於 2024年5月1日

 (5 則留言) (0 個反應) (0 位負責人)TypeScript (13,395 個分叉)batch import
BugDomain: flag: isolatedDeclarationsHelp Wanted

倉庫指標

星標
 (108,860 顆星)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

🔍 Search Terms

  • isolatedDeclarations
  • isolated declaration

✅ Viability Checklist

⭐ Suggestion

I an unsure if it is a bug or a feature request...

An exported const without type annotation and initialized with a regex literal triggers the following error error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. in isolated declaration mode.

If I understand correctly, isolated declaration should allow unannotated const initialized with any literal?

📃 Motivating Example

See an example on the playground.

💻 Use Cases

This could avoid a trivial type annotation.

貢獻者指南