-
-
Save markvincze/d4cbf940687f676bcf6b4e19c7a7b0f3 to your computer and use it in GitHub Desktop.
travix-di typings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IGeneratedClass<T> { | |
new (...args: any[]): T; | |
} | |
export interface IProvider { | |
name: string; | |
useValue?: any; | |
useDefinedValue?: any; | |
useFactory?: (...args: any[]) => any; | |
useClass?: { new(...args: any[]): any; }; | |
deps?: any[]; | |
// NOTE: Providers will have extra properties which are not statically defined here. | |
// This extra property is needed to make TSC less strict, and enable extra properties. | |
[others: string]: any; | |
} | |
export interface IContainer { | |
getDeps(container: IProvider): any; | |
register(container: IProvider): any; | |
get<T extends IProvider>(name: string): T; | |
} | |
export interface IContainerOptions { | |
containerName: string; | |
} | |
export interface IConstructor<T> { | |
new(): T; | |
} | |
export function createClass<T>(extend: T): IGeneratedClass<T>; | |
export function createContainer(providers: IProvider[], options: IContainerOptions): IConstructor<IContainer>; | |
export function resolveContainer<T>(Container: IConstructor<T>): T; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment