-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
After running the control flow migration strict template checking is enforced. #52969
Comments
To limit this down... As soon as the new flow control is used in that template, then strictTemplates are enforced. Other 'non-strict' templates using the old flow control don't trigger strict errors. |
This was discussed in the team today, and the new control flow will not adopt a mode where it disables type-narrowing capabilities and type-checking of its template block. If this poses a problem for your project then continuing to use |
Ouch! I can see your perspective (and I assume there are some technical details hidden away in your choice). But this is going to bite a lot of people and take the shine off things. I do have some follow-up questions/suggestions?
I do love the new flow control and strictTemplates! It's just that we have been on a journey from a place where these didn't exist. |
Another option we're considering is to have the migration add @if ($any(cond)) {
...
} This is how you would opt out of
Control flow will function fine with Eventually we do plan to make |
This is quite a problem especially as we don't have a good solution for #49161 |
So Help me understand this, will you? 😊. In the basic mode where |
Indeed, this is correct. |
Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax. These changes mimic the old behavior by not checking the bodies of `if`, `switch` and `for` blocks in basic mode. Note that the expressions of the blocks are still going to be checked. Fixes angular#52969.
Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax. These changes mimic the old behavior by not checking the bodies of `if`, `switch` and `for` blocks in basic mode. Note that the expressions of the blocks are still going to be checked. Fixes angular#52969.
…in basic mode Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax. These changes mimic the old behavior by not checking the bodies of `if`, `switch` and `for` blocks in basic mode. Note that the expressions of the blocks are still going to be checked. Fixes angular#52969.
…in basic mode Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax. These changes mimic the old behavior by not checking the bodies of `if`, `switch` and `for` blocks in basic mode. Note that the expressions of the blocks are still going to be checked. Fixes angular#52969.
…in basic mode Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax. These changes mimic the old behavior by not checking the bodies of `if`, `switch` and `for` blocks in basic mode. Note that the expressions of the blocks are still going to be checked. Fixes angular#52969.
…in basic mode (#55558) Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax. These changes mimic the old behavior by not checking the bodies of `if`, `switch` and `for` blocks in basic mode. Note that the expressions of the blocks are still going to be checked. Fixes #52969. PR Close #55558
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. |
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
I have a legacy app which doesn't have strictTemplates enabled.
I updated to ng 17 and then built the project without error.
I then ran the preview migration script to convert the project to the new flow control.
I'm now getting errors consistent with strictTemplates. (These aren't issues with the migration going wrong.)
e.g.
error TS2339: Property 'YYYYYYY' does not exist on type 'XXXXXX'.
Can I force strictTemplates off again? (my tsconfig is unchanged between the 2 builds).
Please 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
)Anything else?
No response
The text was updated successfully, but these errors were encountered: