-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Suggestion: Display a honest message when inference cannot be done correctly #3055
Comments
This would be throwing a lot of babies out with very little bathwater. There is tons of code that hits that part of the spec where the types are correct and it would be counterproductive to issue an error in those cases. |
For those parts that are correct no errors are necessary, for other parts that cannot be resolved properly such issue would be very much appreciated. Is there a problem with detecting what can and what cannot be inferred ahead, so that both correct cases with generated code and incorrect ones with error messages are properly covered? |
The entire problem is that we don't have an algorithm for determining what's an error and what isn't. We didn't have that capability and then randomly decide to not issue errors in some cases, of course. |
So we might want to keep this issue open please, don't we? It is certainly a problem that the compiler doesn't work property and it deserves some attention from the community. There are a lot of open requests that ask for much sillier features than this one and yet they don't get closed. |
This is a duplicate of #3038. |
Currently (TS v.1.5.2) the compiler does not do inference correctly for certain cases:
#3038
Although it is by design, reflected in the spec and there is no viable way for doing it correctly, I think the compiler has to be honest to the developer and instead of generating faulty code, it has to break with an error message that would say that the inferred types cannot be resolved.
The text was updated successfully, but these errors were encountered: