-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TS2365 #16854
Comments
Essentially a dupe of #12794 and works as intended. TypeScript is intentionally smart enough to know that this is illogical code and you are making an invalid comparison. |
I think it is a warnning, not a error, because it can execute. |
That tool is generating illogical code and should be fixed. Please see this question on StackOverflow. TypeScript does not have, intentionally, the concept between errors and warnings. You can always choose to ignore the errors as it does not effect the emit. |
I don't know that it helps much to dismiss the generated code as illogical; @zq8024: As mentioned, you can ignore the error if you want. If you have any control over the output of the tool and if the tool is supposed to be outputting TypeScript, then something like … (function () { return <number>1 == 0; } would more clearly communicate to the type checker the intent of the comparison. If you don't have any control over the output of the tool, or if the tool is only supposed to output plain JavaScript as opposed to TypeScript; and you don't want to ignore errors, maybe having TypeScript check and compile it isn't a great idea? Without knowing more about your build configuration, I don't know if it makes sense, but could you reconfigure it to get the tool and the TypeScript compiler out of each other's way? |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
code:
function(){ return 1 == 0; }
compile,then typescript show TS2365 error
The text was updated successfully, but these errors were encountered: