In the following code example:
function* gen() {
let v = yield Promise.resolve(0);
return v;
}
Type is vdefined as any. I am wondering if there is a way to make it infer another type (say, number) based on contextual prompts.
I know that in this particular scenario I can use async/ awaitinstead, but I'm curious about the general case (when not working with promises).
source
share