UNPKG

injection-js

Version:

Dependency Injection library for JavaScript and TypeScript

43 lines (42 loc) 1.33 kB
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { ProviderToken } from './provider-token'; export declare const THROW_IF_NOT_FOUND: Object; /** * @whatItDoes Injector interface * @howToUse * ``` * const injector: Injector = ...; * injector.get(...); * ``` * * @description * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. * * ### Example * * {@example core/di/ts/injector_spec.ts region='Injector'} * * `Injector` returns itself when given `Injector` as a token: * {@example core/di/ts/injector_spec.ts region='injectInjector'} * * @stable */ export declare abstract class Injector { static THROW_IF_NOT_FOUND: Object; static NULL: Injector; abstract get<T>(token: ProviderToken, notFoundValue?: T): T; abstract get<T>(token: ProviderToken<T>, notFoundValue?: T): T; abstract get<T>(token: ProviderToken, notFoundValue?: T | null): T | null; abstract get<T>(token: ProviderToken<T>, notFoundValue?: T | null): T | null; /** * @deprecated use {@link ProviderToken} instead * @suppress {duplicate} */ abstract get(token: any, notFoundValue?: any): any; }