97dc85ba5e
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 |
||
---|---|---|
.. | ||
compliance | ||
diagnostics | ||
helpers | ||
metadata | ||
ngtsc | ||
transformers | ||
BUILD.bazel | ||
extract_i18n_spec.ts | ||
mocks.ts | ||
ngc_spec.ts | ||
perform_compile_spec.ts | ||
perform_watch_spec.ts | ||
test_support.ts | ||
typescript_support_spec.ts |