StrictTemplates and async does not compile.
See original GitHub issueDescribe the bug If the strictTemplates option is true (tsconfig.json > angularCompilerOptions), and a async pipe is used in the [items] input, the build does not compile. A workaround is to add an empty array fallback, but it’s not ideal.
Reproducbile example Example which reproduces described behaviour
To Reproduce Steps to reproduce the behavior (if example is not provided):
- tsconfig.json: set angularCompilerOptions.strictTemplates = true
- Create a template with `<ng-select [items]=“items$ | async”></ng-select>
- Try to compile
Expected behavior
I expect [items] to be typed any[] | null
.
Desktop (please complete the following information):
- OS: MacOS
- Browser: n/a
- Version [e.g. 22]
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Angular 9's Best Hidden Feature: Strict Template Checking
This is because the AOT (Ahead of Time) compilation does not run in Angular 8 unless we explicitly tell it to run or...
Read more >Angular Ivy strictTemplates true Type 'boolean | null' is not ...
The reason is because the async pipes return signature is something like <T>(input$: Observable<T>): T | null always, because it returns ...
Read more >Template type checking - Angular
The compiler does not verify that the value of user.address.city is assignable to ... The strictTemplates family of compiler options should be used...
Read more >Angular compilation restrictions overview
Property 'foo' does not exist on type 'string'. When combining the strictNullChecks and strictTemplates flags, the often used async pipe is ...
Read more >Why to and How To Use Strict Mode in Angular Applications
But if you do not use strict type checking, the possibility to change something ... Keep in mind optionals are syntactic sugar and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
With angular 10 more people are going to use strict mode and therefore bump into this issue.
🎉 This issue has been resolved in version 7.1.0 🎉
The release is available on:
Your semantic-release bot 📦🚀