I expected this code to print the check in Flow , as it is in TypeScript :
var onClick : (() => void) | (() => boolean); onClick = () => { return true; }
Instead, I get this error:
4: onClick = () => { return true; } ^ function. Could not decide which case to select 3: var onClick : (() => void) | (() => boolean); ^ union type
Is there a common name for this design decision, and what is its reasoning?
Is it possible to request a flow check to infer the return type of a function from return statements?
typescript flowtype
Andrey Fedorov
source share