Microsoft/TypeScript

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

Open

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

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)TypeScript (6,726 fork)batch import
BugDomain: flag: isolatedDeclarationsHelp Wanted

倉庫指標

Star
 (48,455 star)
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.

貢獻者指南