-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Invalid some incompatible instantiation of a error #1046
Comments
This is a dupe of #120. The |
So are you implying that flow should error in both cases ? If so mind elaborating on why ? Is it still flow being very cautious about possible mutations that could happen to |
No, this is a real issue, but there's already an open issue for it—Flow doesn't infer polymorphic function types. This is the same reason why this code doesn't work: function id(x) { return x };
id(0);
id(""); Flow sees the first invocation and the type of It should, and that's what Avik meant in the linked issue when he said Flow isn't "polymorphic enough." |
But why does flow reports correct polymorphic type for both implementations of |
Here is a simple code example:
Which produces a following error:
Please also note that flow correctly reports type of
always
:But if I inline type annotations everything seems to work fine:
Also note that flow reports same type for
always
as before:It maybe same issue as #928 although I'm not totally sure, if so we should probably keep this and close the other one since this has a lot more simpler example
The text was updated successfully, but these errors were encountered: