You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actually we can't pass readonly arrays or readonly sets with strictTemplates enabled, because the current types don't support it.
Another thing that is really trivial is that we can't use right now it with | async, as it could return null | undefined and it's also not supported.
I did not try for read-only arrays and maps, but values which can be undefined (and also the async pipe, because it might return undefined) it does not work, e.g.:
Running into this myself with undefined when trying to enable strictTemplates... seems like a fix would be trivial. Has anyone tried submitting one and had it rejected?
Activity
Airblader commentedon Oct 15, 2020
If you need a temporary workaround you can wrap what you're passing to ngClass in
$any():mofogasy commentedon Jul 12, 2021
Do you have any update on this, as this issue is still present in
12.1.0.petebacondarwin commentedon Jul 12, 2021
I can reproduce this problem for
nullbut not for readonly arrays and maps.I created a new Angular project using the CLI (12.1.1) and changed the
AppComponentto be:In the
tsconfig.json, I added:And when I run
ng buildI do not get template type check errors.Am I missing something?
mofogasy commentedon Jul 12, 2021
I did not try for read-only arrays and maps, but values which can be
undefined(and also theasyncpipe, because it might return undefined) it does not work, e.g.:petebacondarwin commentedon Jul 12, 2021
One workaround for the async case would be
{{ (obs$ | async) || '' }}.imirkin commentedon Jul 10, 2022
Running into this myself with
undefinedwhen trying to enablestrictTemplates... seems like a fix would be trivial. Has anyone tried submitting one and had it rejected?Update angular monorepo to v14.2.0 (#1523)
angular-automatic-lock-bot commentedon Sep 1, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.