microsoft / microsoft/TypeScript
Experimental Decorators don't work in `export` statements
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 117
描述
TypeScript Version: JavaScript + ESNext
Search Terms: export+experimental+decorators+export
Code
export default
@x
class A {
}
[❌ ] The above does not work.
@x
class A {}
export default A;
[👌 ] It does work when going with the old syntax, that is splitting export statement and class expression. I.e. this works fine:
Expected behavior:
The syntax should be valid, according to @babel/plugin-proposal-decorators, which is also in line with tc39, as discussed here.
Actual behavior:
The first @ raises:
Expression expected. ts(1109)
Playground Link:
Related Issues:
I previously posted on VSCode issues and was sent here:
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 TypeScript Playground 开始,将失败的示例 export default @x class A {} 与正常工作的拆分声明进行比较。跟踪编译器如何处理导出类之前的装饰器,然后添加覆盖测试,展示预期语法会被接受,同时不会使现有形式出现回归。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100