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.

贡献者指南