-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
46 lines (45 loc) · 1.46 KB
/
index.d.ts
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
declare namespace minimalistAsyncDI {
type Specifier = BeanSpecifier | string;
type Creator = BeanCreator | string;
type Dependency = BeanInjector | string;
type BeanSpecifier = { specifier: true };
type BeanCreator = { creator: true };
type BeanInjector = { injector: true };
const bean: (name: string) => string;
const collection: (
name: string,
getter: (this: any, name: string) => any,
setter: (this: any, name: string, value: any) => any
) => BeanSpecifier;
const replacement: (specifier: Specifier, retainedName?: string) => BeanSpecifier;
const value: (value: any) => BeanCreator & BeanInjector;
const promise: ((promise: Promise<any>) => BeanCreator) &
((name: string) => BeanInjector);
const constructor: (ctor: { new(...args: any): any }) => BeanCreator;
const factory: (factory: function) => BeanCreator;
const bound: (name: string) => BeanInjector;
const promiser: (name: string) => BeanInjector;
const seeker: (name: string) => BeanInjector;
class BeanError extends Error {}
class Container {
get: (name: string) => Promise<any>;
register: (
specifier: Specifier,
creator: Creator,
...dependencies: Dependency[]
) => undefined;
Container = Container;
bean = bean;
collection = collection;
replacement = replacement;
value = value;
promise = promise;
['constructor'] = constructor;
factory = factory;
bound = bound;
promiser = promiser;
seeker = seeker;
BeanError = BeanError;
}
}
export = minimalistAsyncDI;