import * as descriptors from './descriptors'; import { ServiceCollection } from './serviceCollection'; export declare namespace _util { const serviceIds: Map>; const DI_TARGET = "$di$target"; const DI_DEPENDENCIES = "$di$dependencies"; function getServiceDependencies(ctor: any): { id: ServiceIdentifier; index: number; }[]; } export type BrandedService = { _serviceBrand: undefined; }; export interface IConstructorSignature { new (...args: [...Args, ...Services]): T; } export interface ServicesAccessor { get(id: ServiceIdentifier): T; } export declare const IInstantiationService: ServiceIdentifier; /** * Given a list of arguments as a tuple, attempt to extract the leading, non-service arguments * to their own tuple. */ export type GetLeadingNonServiceArgs = TArgs extends [] ? [] : TArgs extends [...infer TFirst, BrandedService] ? GetLeadingNonServiceArgs : TArgs; export interface IInstantiationService { readonly _serviceBrand: undefined; /** * Synchronously creates an instance that is denoted by the descriptor */ createInstance(descriptor: descriptors.SyncDescriptor0): T; createInstance any, R extends InstanceType>(ctor: Ctor, ...args: GetLeadingNonServiceArgs>): R; /** * Calls a function with a service accessor. */ invokeFunction(fn: (accessor: ServicesAccessor, ...args: TS) => R, ...args: TS): R; /** * Creates a child of this service which inherits all current services * and adds/overwrites the given services. */ createChild(services: ServiceCollection): IInstantiationService; } /** * Identifies a service of type `T`. */ export interface ServiceIdentifier { (...args: any[]): void; type: T; } /** * The *only* valid way to create a {{ServiceIdentifier}}. */ export declare function createDecorator(serviceId: string): ServiceIdentifier; export declare function refineServiceDecorator(serviceIdentifier: ServiceIdentifier): ServiceIdentifier;