microsoft / microsoft/TypeScript
Generator prototype ignored
未关闭
还没有人认领这个 Issue。
Awaiting More Feedback
Suggestion
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
TypeScript Version: 3.8.0-dev.20200107
Search Terms: generator, iterator, prototype, inherit
Code
function* gen() {
while (true) {
yield "something";
}
}
gen.prototype.test = () => {
console.log("OK");
};
gen().test();
Expected behavior: No errors
Actual behavior: Error TS2339: Property 'test' does not exist on type 'Generator<string, void, unknown>'
Playground Link: Provided
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提供的 TypeScript Playground 复现开始,将生成器函数的原型类型与 gen() 返回的类型进行比较。跟踪类型检查器如何表示生成器声明和原型成员。完成标准是示例能够在没有 TS2339 的情况下编译,同时保留正确的生成器和迭代器类型推断。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100