TypeScript/tests/cases/conformance/generators/generatorYieldContextualType.ts
Ron Buckton 049618f7da
Get contextual type of yield from contextual signature of containing function (#32433)
* Get contextual type of yield from contextual signature of containing function

* Add missing baseline
2019-07-16 17:16:21 -07:00

14 lines
356 B
TypeScript

// @target: esnext
// @strict: true
// @noEmit: true
declare function f1<T, R, S>(gen: () => Generator<R, T, S>): void;
f1<0, 0, 1>(function* () {
const a = yield 0;
return 0;
});
declare function f2<T, R, S>(gen: () => Generator<R, T, S> | AsyncGenerator<R, T, S>): void;
f2<0, 0, 1>(async function* () {
const a = yield 0;
return 0;
});