microsoft / microsoft/TypeScript
Trailing comma in dynamic import should be allowed also when used in a `typeof` type
未关闭
还没有人认领这个 Issue。
Domain: ES Modules
Help Wanted
Possible Improvement
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
🔎 Search Terms
trailing comma dynamic import
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
💻 Code
declare module "foo" {}
const v = await import("foo",);
type T = typeof import("foo",);
const v2 = await import("foo",{},);
type T2 = typeof import("foo",{},);
🙁 Actual behavior
The trailing commas in the type-level import()s are reported as syntax error
🙂 Expected behavior
The syntax of import() at the type-level should match the one at the value level, thus allowing trailing commas.
Additional information about the issue
Note that the error was correct before import attributes, but import attributes changed the dynamic import syntax to allow trailing commas.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 TypeScript Playground 开始,复现值级别和类型级别动态导入中使用尾随逗号的情况。比较这两种形式的解析方式,然后为两个示例添加回归覆盖。完成标准是 typeof import() 接受与值级别 import() 相同的尾随逗号语法。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100