-
I am having a bit of a trouble with
But now, that means I have to specify the correct return type of the function, or else typescript complains. So I tried something like this
and wrapping the using it as following:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There are a lot of problems with generators in TypeScript. Basically, TypeScript can't infer the type of yield expressions in such simple cases: const foo = yield 1; // variable foo has type 'any' instead of 'number' Here is the open issue: microsoft/TypeScript#32523 |
Beta Was this translation helpful? Give feedback.
There are a lot of problems with generators in TypeScript. Basically, TypeScript can't infer the type of yield expressions in such simple cases:
Here is the open issue: microsoft/TypeScript#32523
Currently, generators in TypeScript aren't type-safe and not very convenient to use. Mobx can't fix that.