UNPKG

851 BTypeScriptView Raw
1/**
2 * Container options.
3 */
4export interface UseContainerOptions {
5 /**
6 * If set to true, then default container will be used in the case if given container haven't returned anything.
7 */
8 fallback?: boolean;
9 /**
10 * If set to true, then default container will be used in the case if given container thrown an exception.
11 */
12 fallbackOnErrors?: boolean;
13}
14export declare type ContainedType<T> = {
15 new (...args: any[]): T;
16} | Function;
17export interface ContainerInterface {
18 get<T>(someClass: ContainedType<T>): T;
19}
20/**
21 * Sets container to be used by this library.
22 */
23export declare function useContainer(iocContainer: ContainerInterface, options?: UseContainerOptions): void;
24/**
25 * Gets the IOC container used by this library.
26 */
27export declare function getFromContainer<T>(someClass: ContainedType<T>): T;