singleton-proxy
Version:
A lightweight TypeScript singleton implementation using Proxy pattern
6 lines (5 loc) • 303 B
TypeScript
type Constructor<T = any> = new (...args: any[]) => T;
type AnyFunction<T = any> = (...args: any[]) => T;
export declare function singleton<T extends object>(target: Constructor<T>): Constructor<T>;
export declare function singleton<T extends object>(target: AnyFunction<T>): AnyFunction<T>;
export {};