question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StrictTemplates and async does not compile.

See original GitHub issue

Describe 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):

  1. tsconfig.json: set angularCompilerOptions.strictTemplates = true
  2. Create a template with `<ng-select [items]=“items$ | async”></ng-select>
  3. 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
sweco-senaricommented, Aug 7, 2020

With angular 10 more people are going to use strict mode and therefore bump into this issue.

0reactions
github-actions[bot]commented, Jun 30, 2021

🎉 This issue has been resolved in version 7.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found