-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional Parameters with TypeScript and Flow #1569
Comments
Can't reproduce the compilation error with mobx 4.2.0, ts 2.8.1 const init = flow(function *(name: string, age?: number) {
yield console.log(name);
yield console.log(age);
}); can u provide a jsfiddle link or any other similar demos? |
@kuitos just try to call function that you created with 2 parameters and you would get an error: |
the same to me. |
Same here! |
Same here |
Potentially fixed by #1816 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I have a question about using mobx 4's async flow in conjunction with TypeScript (strict mode). What is the best way to handle optional parameters being passed to the generator function. Here's an example of what I'm talking about:
The above would lead to the compilation error:
"TS2554: Expected 1 arguments, but got 2"
I was able to get around this by wrapping flow in a HoF that handles the optional params. Is there another solution to this, or has that functionality not yet been integrated for flow?
The text was updated successfully, but these errors were encountered: