-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Open
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilercompiler: template type-checkingfreq1: lowstate: confirmedtype: bug/fixworkaround2: non-obvious
Milestone
Description
🐞 bug report
Affected Package
The issue is caused by package @angular/compiler?Is this a regression?
?
Description
- enable Ivy
- enable
strictTemplates - enable
strictNullChecks - use an expression like
foo?.bar.bazin a templatefoois nullable,baris not- template compiler shows error on
baz:Object is possibly 'undefined'.
- note that the whole chain ends if
foois nullish (long short circuiting), therefore accessingbazis always safe - disabling
strictNullChecksmakes the compile error go away and everything functions as expected without runtime error (i.e. Angular's optional chaining also does long short circuiting)
🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-ivy-pu8dk5
🔥 Exception or Error
`Object is possibly 'undefined'.`
🌍 Your Environment
Angular Version:
@angular/animations 9.1.11
@angular/common 9.1.11
@angular/compiler 9.1.11
@angular/core 9.1.11
@angular/forms 9.1.11
@angular/platform-browser 9.1.11
@angular/platform-browser-dynamic 9.1.11
@angular/router 9.1.11
Anything else relevant?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilercompiler: template type-checkingfreq1: lowstate: confirmedtype: bug/fixworkaround2: non-obvious