microsoft / microsoft/TypeScript
`export import` of types is not allowed in namespaces when using `erasableSyntaxOnly`
未关闭
还没有人认领这个 Issue。
Awaiting More Feedback
Has Repro
Suggestion
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
🔎 Search Terms
export import alias type-only namespaces erasableSyntaxOnly
🕗 Version & Regression Information
- I was unable to test this on prior versions because
erasableSyntaxOnlywas just released
⏯ Playground Link
💻 Code
// this works
namespace types {
export declare type Foo = 1
}
// but this doesn't work, although it's type-only, too
namespace typesWithReexport {
export import T = types
}
// ignoring the error, generally these should be both accessible
type a = types.Foo
type x = typesWithReexport.T.Foo
🙁 Actual behavior
export import re-exporting a namespace (or namespace member) of a type-only namespace from another type-only namespace results in This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
🙂 Expected behavior
It should not error.
Additional information about the issue
@jakebailey asked me to open an issue to track this on bsky: https://bsky.app/profile/jakebailey.dev/post/3ljdc3ou7oc2w
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从使用 erasableSyntaxOnly 的链接 TypeScript Playground 复现开始,并比较被接受的 export declare type 命名空间与被拒绝的 export import 再导出。跟踪命名空间示例的编译器诊断,并确定相关的 erasable syntax 检查。示例不再报告该错误,同时保留预期的仅类型命名空间访问,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100