-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.d.ts
More file actions
28 lines (22 loc) · 1.02 KB
/
types.d.ts
File metadata and controls
28 lines (22 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
declare module '@basd/registry' {
type AnyFunction = (...args: any[]) => any;
type AnyObject = Record<string, any>;
interface Config {
classes?: Record<string, AnyFunction>;
}
class Registry {
constructor(config: Config);
classes: Record<string, AnyFunction>;
createInstance(name: string, args: any[], baseClass: AnyFunction): any;
isValidClass(targetClass: AnyFunction | null, baseClass: AnyFunction | null): boolean;
isValidInstance(instance: any, baseClass: AnyFunction | null): boolean;
ingest(source: { constructor: { classes: AnyObject }, opts: { classes: AnyObject } }): void;
setWith(name: string, targetClass: AnyFunction, baseClass: AnyFunction, override?: boolean): void;
set(name: string, targetClass: AnyFunction, override?: boolean): void;
setMany(classes: Record<string, AnyFunction>, override?: boolean): void;
get(name: string, defaultValue?: any): any;
has(name: string): boolean;
static get(config: Config | Registry): Registry;
}
export = Registry;
}