export type ValueType = 'value'; export type FactoryType = 'factory'; export type TypeType = 'type'; export type ProviderType = ValueType | FactoryType | TypeType; export type InjectAnnotated = { $inject?: string[]; }; export type ScopeAnnotated = { $scope?: string[]; }; export type Annotated = InjectAnnotated & ScopeAnnotated; export type Constructor = ( { new (...args: any[]): T } | { (...args: any[]): T } ); export type InitializerFunction = { (...args: any[]): unknown } & Annotated; export type FactoryFunction = { (...args: any[]): T; } & Annotated; export type ArrayArgs = [ T ] | [ string, T ] | [ string, string, T ] | [ string, string, string, T ] | [ string, string, string, string, T ] | [ string, string, string, string, string, T ] | [ string, string, string, string, string, string, T ] | [ string, string, string, string, string, string, string, T ] | [ string, string, string, string, string, string, string, string, T ] | [ string, string, string, string, string, string, string, string, string, T ]; export type ServiceProvider = { (name: string): T; }; export type Initializer = InitializerFunction | ArrayArgs; export type FactoryDefinition = FactoryFunction | ArrayArgs>; export type TypeDefinition = Constructor | ArrayArgs>; export type ValueDefinition = T; export type ServiceDefinition = FactoryDefinition | TypeDefinition | ValueDefinition; type TypedDeclaration = [ T, D ] | [ T, D, 'private' ]; export type ServiceDeclaration = TypedDeclaration> | TypedDeclaration> | TypedDeclaration>; export type ModuleDeclaration = { [name: string]: ServiceDeclaration | unknown; __init__?: Array; __depends__?: Array; __exports__?: Array; __modules__?: Array; }; // injector.js export type InjectionContext = unknown; export type LocalsMap = { [name: string]: unknown }; export type ModuleDefinition = ModuleDeclaration; export class Injector { constructor(modules: ModuleDefinition[], parent?: InjectorContext); get(name: string, strict?: boolean): T; invoke(func: (...args: any[]) => T, context?: InjectionContext, locals?: LocalsMap): T; instantiate(constructor: { new (...args: any[]) : T }): T; createChild(modules: ModuleDefinition[], forceNewInstances?: string[]): Injector; init(): void; /** * @internal */ _providers: object; } export type InjectorContext = { get(name: string, strict?: boolean): T; /** * @internal */ _providers?: object }; // annotation.js export function annotate(...args: unknown[]): T & InjectAnnotated; export function parseAnnotations(fn: unknown) : string[];