microsoft / microsoft/TypeScript
Strange 2488 error involving overload resolution and this parameter type
オープン
@rbuckton がすでに取り組んでいます。
2024年10月31日 から。
Needs Investigation
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
yield ts2488 never iterator
🕗 Version & Regression Information
- This changed between versions 3.5.1 and 3.6.2
every-ts bisect gives: e8bf9584aa74aabfecb51a02edb13e3657508274 is the first bad commit
⏯ Playground Link
💻 Code
declare function fn<T>(value: () => T): { (): T };
declare function fn<T>(value: T): Iterable<unknown>;
export class A {
a = fn(function* (this: A) {
yield* fn(1); // error
});
b = fn(function* (this: A) {
const temp = fn(1); // ok
yield* temp;
});
}
🙁 Actual behavior
src/error.ts:6:16 - error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator.
6 yield* fn(1);
~~~~~
🙂 Expected behavior
No error, as in A.b
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。