Created
October 16, 2022 00:20
-
-
Save cefn/f27f4b29f1f2029c7a692d7955b29461 to your computer and use it in GitHub Desktop.
Inference of T yielded by Generator or AsyncGenerator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Yielded< | |
G extends Generator<any, any, any> | AsyncGenerator<any, any, any> | |
> = G extends Generator<infer T, any, any> | |
? T | |
: G extends AsyncGenerator<infer AsyncT, any, any> | |
? AsyncT | |
: never; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment