Skip to content
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

Default value seems to be ignored #9018

Closed
Robloche opened this issue Mar 6, 2023 · 0 comments
Closed

Default value seems to be ignored #9018

Robloche opened this issue Mar 6, 2023 · 0 comments
Assignees
Labels

Comments

@Robloche
Copy link

Robloche commented Mar 6, 2023

Using the following syntax (which has worked until recent flow update), I get an incompatible-call error:

const foo: (a: number, b?: number) => number = (a, b = 100) => Math.min(a, b);

This syntax, however, works:

const foo = (a: number, b?: number = 100): number => Math.min(a, b);

But these two syntaxes should be equivalent, right?

Try:
https://flow.org/try/#0MYewdgzgLgBAZiEMC8MAUBDAXDMBXAWwCMBTAJwBoYiB+HfY8lGARgAY2BKew0slAHwwAshigALAHQEAlmExUinANwAoVaEiwiGMjkw9GlanVy9ynQWaPMF1Zuy5XRE6XLtK1G8NGoYAXvrY1nyKhnyWyEIMfLYYipFCLlKy8vHUKqpAA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants