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
feat(core): support injection tokens as predicate in queries
Currently Angular internally already handles `InjectionToken` as
predicates for queries. This commit exposes this as public API
as people already relied on this functionality but currently used
workarounds to satisfy the type constraints (e.g. `as any`).
We intend to make this public as it low-effort, and it's a signficant
key part for the use of light-weight tokens as described in the upcoming
guide: angular#36144.
In concrete, applications might use injection tokens over class for both DI
and queries, because otherwise such class references for optional queries or DI
always cause these classes to be retained. This was also an issue in View Engine,
but now with Ivy, this pattern became worse as factories could be directly attached
to retained classes (ultimately ending up in the production bundle, while unused).
More details in the light-weight token guide and in:
https://github.com/angular/angular-cli/issues/16866.
Closesangular#21152.
0 commit comments