MCPcopy Index your code
hub / github.com/angular/angular / getInheritedInjectableDef

Function getInheritedInjectableDef

packages/core/src/di/interface/defs.ts:232–246  ·  view source on GitHub ↗
(type: any)

Source from the content-addressed store, hash-verified

230 * scenario if we find the `ɵprov` on an ancestor only.
231 */
232export function getInheritedInjectableDef<T>(type: any): ɵɵInjectableDeclaration<T> | null {
233 // if the ɵprov prop exist but is undefined we still want to return null
234 const def = type?.[NG_PROV_DEF] ?? null;
235
236 if (def) {
237 ngDevMode &&
238 console.warn(
239 `DEPRECATED: DI is instantiating a token "${type.name}" that inherits its @Injectable decorator but does not provide one itself.\n` +
240 `This will become an error in a future version of Angular. Please add @Injectable() to the "${type.name}" class.`,
241 );
242 return def;
243 } else {
244 return null;
245 }
246}
247
248/**
249 * Read the injector def type in a way which is immune to accidentally reading inherited value.

Callers 1

Calls 1

warnMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…