Repository navigation
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilercompiler: template type-checkingstate: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
Yes
Description
After updating one of my projects from v13.1.x to v.13.2.x or v13.3.x the project would not compile anymore with a very generic error message.
Narrowing down the bug was thus very difficult. By successive testing of all modules in the project I was able to achieve a minimal reproduction of the bug.
The following setup crashes the app:
- nullish coalescing in template which might not be needed (The left side of this nullish coalescing operation does not include 'null' or 'undefined' in its type, therefore the '??' operator can be safely removed.)
- strictTemplates mode in angular compiler options enabled
- component using a generic extending a Record
Removing the unnecessary nullish coalescing in this case makes the project compile again.
Please provide a link to a minimal reproduction of the bug
Please provide the exception or error you saw
<e> [webpack-dev-middleware] Error: Cannot read properties of null (reading 'span')
<e> at analyzingFileEmitter (C:\.....\node_modules\@ngtools\webpack\src\ivy\plugin.js:456:23)
<e> at processTicksAndRejections (node:internal/process/task_queues:96:5)
<e> at async AngularWebpackPlugin.rebuildRequiredFiles (C:\.....\node_modules\@ngtools\webpack\src\ivy\plugin.js:281:36)
<e> at async C:\.....\node_modules\@ngtools\webpack\src\ivy\plugin.js:222:17
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 13.3.0
Node: 16.13.0
Package Manager: npm 8.1.0
OS: win32 x64
Angular: 13.3.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1303.0
@angular-devkit/build-angular 13.3.0
@angular-devkit/core 13.3.0
@angular-devkit/schematics 13.3.0
@schematics/angular 13.3.0
rxjs 7.5.5
typescript 4.6.2
Anything else?
No response
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilercompiler: template type-checkingstate: has PR
Activity
JoostK commentedon Mar 22, 2022
There seem to be at least two issues here:Here's what I found out:the usage of null-coalescing here should be valid, as the LHS is nullable.Oh, I missed thengIf!The easiest workaround would be to disable the extended check for nullish coalescing.
fix(compiler-cli): handle inline type-check blocks in nullish coalesc…
fix(compiler-cli): handle inline type-check blocks in nullish coalesc…
fix(compiler-cli): handle inline type-check blocks in nullish coalesc…
angular-automatic-lock-bot commentedon Apr 29, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.