angular-cn/goldens/public-api/core
Paul Gschwendtner 97dc85ba5e feat(core): support injection token as predicate in queries (#37506)
Currently Angular internally already handles `InjectionToken` as
predicates for queries. This commit exposes this as public API as
developers already relied on this functionality but currently use
workarounds to satisfy the type constraints (e.g. `as any`).

We intend to make this public as it's low-effort to support, and
it's a significant key part for the use of light-weight tokens as
described in the upcoming guide: https://github.com/angular/angular/pull/36144.

In concrete, applications might use injection tokens over classes
for both optional DI and queries, because otherwise such references
cause classes to be always retained. This was also an issue in View
Engine, but now with Ivy, this pattern became worse, as factories are
directly attached to retained classes (ultimately ending up in the
production bundle, while being unused).

More details in the light-weight token guide and in: https://github.com/angular/angular-cli/issues/16866.

Closes #21152. Related to #36144.

PR Close #37506
2020-06-11 13:21:11 -07:00
..
testing ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00
core.d.ts feat(core): support injection token as predicate in queries (#37506) 2020-06-11 13:21:11 -07:00
global_utils.d.ts ci: move public-api goldens to goldens directory (#35768) 2020-03-10 20:58:39 -04:00