|
| 1 | +=== tests/cases/compiler/contextualTypeOnYield.ts === |
| 2 | +type FuncOrGeneratorFunc = () => (number | Generator<(arg: number) => void, any, void>) |
| 3 | +>FuncOrGeneratorFunc : Symbol(FuncOrGeneratorFunc, Decl(contextualTypeOnYield.ts, 0, 0)) |
| 4 | +>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --)) |
| 5 | +>arg : Symbol(arg, Decl(contextualTypeOnYield.ts, 0, 54)) |
| 6 | + |
| 7 | +const f: FuncOrGeneratorFunc = function*() { |
| 8 | +>f : Symbol(f, Decl(contextualTypeOnYield.ts, 2, 5)) |
| 9 | +>FuncOrGeneratorFunc : Symbol(FuncOrGeneratorFunc, Decl(contextualTypeOnYield.ts, 0, 0)) |
| 10 | + |
| 11 | + yield (num) => console.log(num); // `num` should be inferred to have type `number`. |
| 12 | +>num : Symbol(num, Decl(contextualTypeOnYield.ts, 3, 9)) |
| 13 | +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) |
| 14 | +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) |
| 15 | +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) |
| 16 | +>num : Symbol(num, Decl(contextualTypeOnYield.ts, 3, 9)) |
| 17 | +} |
0 commit comments