-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Better "always true/false" errors #25251
Conversation
Shoudn't it be "indicate" ? (without the "s") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indicate*
Thanks for indicating that typo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Human friendlier messages, please.
@@ -1252,6 +1252,10 @@ | |||
"category": "Error", | |||
"code": 2366 | |||
}, | |||
"The types of these values indicate that this condition will always be '{0}'.": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If those are statically known primitive types, can we include actual values in error message? Like:
"These values are known to be '{0}' and '{1}', rendering this condition always '{2}'."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check out #25311
@@ -235,7 +238,8 @@ tests/cases/compiler/capturedLetConstInLoop5.ts(229,13): error TS2365: Operator | |||
(() => x + y + v); | |||
if (x == 1) { | |||
~~~~~~ | |||
!!! error TS2365: Operator '==' cannot be applied to types '0' and '1'. | |||
!!! error TS2367: The types of these values indicate that this condition will always be 'false'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These values are known to be '0' and '1', rendering this condition always 'false'.
^^^^ how much smoother to comprehend and fix!
Fixes #25245