@solidgrounds/core
Version:
Dependency injection container
20 lines (19 loc) • 651 B
TypeScript
import { PickByValue } from 'utility-types';
export declare type ServiceFactory<T> = () => T;
/**
* Short service factory
*/
export declare type SF<T> = ServiceFactory<T>;
/**
* Unknown service factory
*/
export declare type USF = ServiceFactory<unknown>;
/**
* Key or service factory
*/
export declare type KSF<T, V> = ServiceFactory<V> | keyof PickByValue<T, V>;
export declare type ServicesAsFactories<Services> = {
[K in keyof Services]: ServiceFactory<Services[K]>;
};
export declare function assertServiceFactory(sf: unknown, name: string): asserts sf is USF;
export declare const isServiceFactory: (target: unknown) => target is USF;