microsoft / microsoft/TypeScript

Should not allow `import.defer?.('x')`

未关闭
#63,679 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Domain: Parser Help Wanted
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

### 🔎 Search Terms

"import defer"

### 🕗 Version & Regression Information

- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about __6.0.3_______
- I was unable to test this on prior versions because _______

### ⏯ Playground Link

https://www.typescriptlang.org/play/?moduleResolution=99&target=99&ssl=3&ssc=40&pln=2&pc=1#code/JYWwDg9gTgLgBPAZlCI4HIYE8wFMDOAxlMGDOgNwBQVhEAdvvGHALxyiSwB0AJrolxQA-NwAUmHAWKlyASgpA

### 💻 Code

```ts
import.defer?.('x');
```

### 🙁 Actual behavior

No errors.

### 🙂 Expected behavior

Should not allow it as an optional call.

### Additional information about the issue

Parsers like Oxc, Yuku, SWC, Babel all reject it. I didn't read the spec, but unless they are wrong.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从提供的 TypeScript Playground 链接和 `import.defer?.('x')` 示例开始,复现 parser 的行为。跟踪 import-defer 语法的 parser 入口点,并将其处理方式与 Oxc、Yuku、SWC 和 Babel 报告的拒绝行为进行比较。完成标准是这段代码被拒绝,而不是被接受为可选调用,并且有一个覆盖该情况的回归测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
compilers
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
描述清楚
新手友好度
70/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。