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
@switch
does not have type awareness in case statements
#52315
Labels
bug
core: control flow
Issues related to the built-in control flow (@if, @for, @switch)
state: has PR
Comments
closed because duplicate issue #52107 |
actually its not a dupe, that other issue is about exhaustive type checking, my one is about more basic type awareness |
crisbeto
added a commit
to crisbeto/angular
that referenced
this issue
Oct 23, 2023
…ncompatible type comparisons In angular#52110 the compiler was changed to produce `if` statements when type checking `@switch` in order to avoid a bug in the TypeScript compiler. In order to avoid duplicate diagnostics, the main `@switch` expression was ignored in each of the `@case` comparisons. This appears to have caused a regression where comparing incompatible types wasn't being reported anymore. These changes resolve the issue by wrapping the expression in parentheses which allows the compiler to report comparison diagnostics while ignoring diagnostics in the expression itself. Fixes angular#52315.
crisbeto
added
state: has PR
bug
core: control flow
Issues related to the built-in control flow (@if, @for, @switch)
labels
Oct 23, 2023
crisbeto
added a commit
to crisbeto/angular
that referenced
this issue
Oct 23, 2023
…ncompatible type comparisons In angular#52110 the compiler was changed to produce `if` statements when type checking `@switch` in order to avoid a bug in the TypeScript compiler. In order to avoid duplicate diagnostics, the main `@switch` expression was ignored in each of the `@case` comparisons. This appears to have caused a regression where comparing incompatible types wasn't being reported anymore. These changes resolve the issue by wrapping the expression in parentheses which allows the compiler to report comparison diagnostics while ignoring diagnostics in the expression itself. Fixes angular#52315.
dylhunn
pushed a commit
that referenced
this issue
Oct 23, 2023
…ncompatible type comparisons (#52322) In #52110 the compiler was changed to produce `if` statements when type checking `@switch` in order to avoid a bug in the TypeScript compiler. In order to avoid duplicate diagnostics, the main `@switch` expression was ignored in each of the `@case` comparisons. This appears to have caused a regression where comparing incompatible types wasn't being reported anymore. These changes resolve the issue by wrapping the expression in parentheses which allows the compiler to report comparison diagnostics while ignoring diagnostics in the expression itself. Fixes #52315. PR Close #52322
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
tbondwilkinson
pushed a commit
to tbondwilkinson/angular
that referenced
this issue
Dec 6, 2023
…ncompatible type comparisons (angular#52322) In angular#52110 the compiler was changed to produce `if` statements when type checking `@switch` in order to avoid a bug in the TypeScript compiler. In order to avoid duplicate diagnostics, the main `@switch` expression was ignored in each of the `@case` comparisons. This appears to have caused a regression where comparing incompatible types wasn't being reported anymore. These changes resolve the issue by wrapping the expression in parentheses which allows the compiler to report comparison diagnostics while ignoring diagnostics in the expression itself. Fixes angular#52315. PR Close angular#52322
ChellappanRajan
pushed a commit
to ChellappanRajan/angular
that referenced
this issue
Jan 23, 2024
…ncompatible type comparisons (angular#52322) In angular#52110 the compiler was changed to produce `if` statements when type checking `@switch` in order to avoid a bug in the TypeScript compiler. In order to avoid duplicate diagnostics, the main `@switch` expression was ignored in each of the `@case` comparisons. This appears to have caused a regression where comparing incompatible types wasn't being reported anymore. These changes resolve the issue by wrapping the expression in parentheses which allows the compiler to report comparison diagnostics while ignoring diagnostics in the expression itself. Fixes angular#52315. PR Close angular#52322
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
bug
core: control flow
Issues related to the built-in control flow (@if, @for, @switch)
state: has PR
Which @angular/* package(s) are the source of the bug?
compiler-cli
Is this a regression?
No
Description
Am using package versions of
17.0.0-rc.0
, with extension versionv17.0.0-next.2
.When either using
ng build
or in vscode itself, there is no error thrown for the below code,isDebug
is type boolean yet the case statements conflict with that type.Interestingly on mouseover, it does look like an attempt to perform type coercion happens, resulting predictably in a
never
typePlease provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version
)No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: