Skip to content

optional chaining in template uses 'null', but strictTemplates treats it as 'undefined' #37622

@ajafff

Description

@ajafff

🐞 bug report

Affected Package

The issue is caused by package @angular/compiler or @angular/language-service?

Is this a regression?

no

Description

Using optional chaining (or safe navigation operator) in templates uses null, but the language-service and compiler (with strictTemplates) treat it as undefined.

This is not a request to change null to undefined (that's proposed by #34385). Instead I want the static types to be correct so I'm not surprised by the different semantics of Angular's safe navigation operator compared to TypeScript/ECMAScript.

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-ivy-hh5mwz?file=src%2Fapp%2Fapp.component.ts

🔥 Exception or Error





🌍 Your Environment

Angular Version:


9.1.11


Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions