You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug.ts:8:12 - error TS2367: This comparison appears to be unintentional because the types '5' and '12' have no overlap.
8 if(x == 12) { /* ... */ }
~~~~~~~
This error should not show when compiling as x is set to 12 when calling the change_x function.
🙂 Expected behavior
It is expected that there is no error given when compiling.
Additional information about the issue
This can be navigated around by introducing a second variable before the switch statement.
🔎 Search Terms
switch, case, indirect, unintentional, comparison, change, equality, update, modify, if
🕗 Version & Regression Information
This is the behavior in every version I tried, and I could not find FAQ entries related to the issue.
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.7.0-beta#code/DYUwLgBAHhC8EFYDcAoAZgVwHYGMwEsB7LCHACwEMsBzEAfSgAoBKCAb2jggEYAmJCAF8UKAM4B3fGHKMorNighLSFUSEQAuRcp3kqtBi1TadS-Gllx4feRAD0AKggA6VxAd2hKQUA
💻 Code
🙁 Actual behavior
This error should not show when compiling as
x
is set to12
when calling thechange_x
function.🙂 Expected behavior
It is expected that there is no error given when compiling.
Additional information about the issue
This can be navigated around by introducing a second variable before the switch statement.
This code no longer produces an error in the latest version
see playground
The text was updated successfully, but these errors were encountered: