馃悶 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.baz in a template
foo is nullable, bar is not
- template compiler shows error on
baz: Object is possibly 'undefined'.
- note that the whole chain ends if
foo is nullish (long short circuiting), therefore accessing baz is always safe
- disabling
strictNullChecks makes 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?
馃悶 bug report
Affected Package
The issue is caused by package @angular/compiler?Is this a regression?
?
Description
strictTemplatesstrictNullChecksfoo?.bar.bazin a templatefoois nullable,baris notbaz:Object is possibly 'undefined'.foois nullish (long short circuiting), therefore accessingbazis always safestrictNullChecksmakes 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
馃實 Your Environment
Angular Version:
Anything else relevant?