@spinajs/di 2.0.180 → 2.0.182

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/lib/cjs/array.d.ts +10 -10
  2. package/lib/cjs/array.js +13 -13
  3. package/lib/cjs/binder.d.ts +39 -39
  4. package/lib/cjs/binder.js +96 -96
  5. package/lib/cjs/container-cache.d.ts +17 -17
  6. package/lib/cjs/container-cache.js +63 -63
  7. package/lib/cjs/container.d.ts +133 -133
  8. package/lib/cjs/container.js +466 -466
  9. package/lib/cjs/container.js.map +1 -1
  10. package/lib/cjs/decorators.d.ts +141 -141
  11. package/lib/cjs/decorators.js +303 -303
  12. package/lib/cjs/enums.d.ts +31 -31
  13. package/lib/cjs/enums.js +35 -35
  14. package/lib/cjs/enums.js.map +1 -1
  15. package/lib/cjs/exceptions.d.ts +17 -17
  16. package/lib/cjs/exceptions.js +25 -25
  17. package/lib/cjs/helpers.d.ts +35 -35
  18. package/lib/cjs/helpers.js +86 -86
  19. package/lib/cjs/index.d.ts +12 -12
  20. package/lib/cjs/index.js +41 -41
  21. package/lib/cjs/interfaces.d.ts +172 -172
  22. package/lib/cjs/interfaces.js +53 -53
  23. package/lib/cjs/registry.d.ts +14 -14
  24. package/lib/cjs/registry.js +80 -80
  25. package/lib/cjs/root.d.ts +108 -108
  26. package/lib/cjs/root.js +216 -217
  27. package/lib/cjs/root.js.map +1 -1
  28. package/lib/cjs/types.d.ts +13 -13
  29. package/lib/cjs/types.js +2 -2
  30. package/lib/mjs/array.d.ts +10 -10
  31. package/lib/mjs/array.js +9 -9
  32. package/lib/mjs/binder.d.ts +39 -39
  33. package/lib/mjs/binder.js +92 -92
  34. package/lib/mjs/container-cache.d.ts +17 -17
  35. package/lib/mjs/container-cache.js +59 -59
  36. package/lib/mjs/container.d.ts +133 -133
  37. package/lib/mjs/container.js +459 -459
  38. package/lib/mjs/container.js.map +1 -1
  39. package/lib/mjs/decorators.d.ts +141 -141
  40. package/lib/mjs/decorators.js +266 -266
  41. package/lib/mjs/enums.d.ts +31 -31
  42. package/lib/mjs/enums.js +32 -32
  43. package/lib/mjs/enums.js.map +1 -1
  44. package/lib/mjs/exceptions.d.ts +17 -17
  45. package/lib/mjs/exceptions.js +19 -19
  46. package/lib/mjs/helpers.d.ts +35 -35
  47. package/lib/mjs/helpers.js +72 -72
  48. package/lib/mjs/index.d.ts +12 -12
  49. package/lib/mjs/index.js +12 -12
  50. package/lib/mjs/interfaces.d.ts +172 -172
  51. package/lib/mjs/interfaces.js +45 -45
  52. package/lib/mjs/registry.d.ts +14 -14
  53. package/lib/mjs/registry.js +76 -76
  54. package/lib/mjs/root.d.ts +108 -108
  55. package/lib/mjs/root.js +159 -159
  56. package/lib/mjs/types.d.ts +13 -13
  57. package/lib/mjs/types.js +1 -1
  58. package/lib/tsconfig.cjs.tsbuildinfo +1 -1
  59. package/lib/tsconfig.mjs.tsbuildinfo +1 -1
  60. package/package.json +2 -2
package/lib/mjs/root.d.ts CHANGED
@@ -1,109 +1,109 @@
1
- import { IBind, IContainer, AsyncService, ResolvableObject } from './interfaces.js';
2
- import { Class, Factory } from './types.js';
3
- import { TypedArray } from './array.js';
4
- /**
5
- * App main DI container
6
- */
7
- export declare const RootContainer: IContainer;
8
- /***
9
- * EVENT LISTENER STUFF
10
- *
11
- * Allows to use event listener stuff on root container
12
- */
13
- export declare function setESMModuleSupport(): void;
14
- export declare function on(event: string, listener: (...args: unknown[]) => void): IContainer;
15
- export declare function addListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
16
- export declare function once(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
17
- export declare function removeListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
18
- export declare function off(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
19
- export declare function removeAllListeners(event?: string | symbol): IContainer;
20
- export declare function setMaxListeners(n: number): IContainer;
21
- export declare function getMaxListeners(): number;
22
- export declare function listeners(event: string | symbol): Function[];
23
- export declare function rawListeners(event: string | symbol): Function[];
24
- export declare function emit(event: string | symbol, ...args: unknown[]): boolean;
25
- export declare function listenerCount(type: string | symbol): number;
26
- export declare function prependListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
27
- export declare function prependOnceListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
28
- export declare function eventNames(): (string | symbol)[];
29
- /**
30
- * ===========================================================================
31
- */
32
- /**
33
- * Clears root container registry and cache.
34
- */
35
- export declare function clear(): void;
36
- /**
37
- * Clears out root registry ( registered types in root container )
38
- */
39
- export declare function clearRegistry(): void;
40
- /**
41
- * Cleart ous root cache ( all resolved types )
42
- */
43
- export declare function clearCache(): void;
44
- export declare function dispose(): Promise<void>;
45
- /**
46
- * Register class/interface to DI root container. If
47
- * @param type - interface object to register
48
- * @throws {@link InvalidArgument} if type is null or undefined
49
- */
50
- export declare function register<T>(type: Class<T> | Factory<T> | ResolvableObject): IBind;
51
- export declare function unregister<T>(type: string | Class<T> | Factory<T> | ResolvableObject): void;
52
- export declare function uncache<T>(type: string | Class<T> | TypedArray<T>, parent?: boolean): void;
53
- /**
54
- * Resolves specified type from root container.
55
- *
56
- * @param type - class to resolve
57
- * @param options - optional parameters passed to class constructor
58
- * @param check - use parent container to check when resolving
59
- * @throws {@link InvalidArgument} if type is null or undefined
60
- */
61
- export declare function resolve<T>(type: string, options?: unknown[], check?: boolean): T;
62
- export declare function resolve<T>(type: string, check?: boolean): T;
63
- export declare function resolve<T>(type: Class<T>, check?: boolean): T extends AsyncService ? Promise<T> : T;
64
- export declare function resolve<T>(type: TypedArray<T>, check?: boolean): T extends AsyncService ? Promise<T[]> : T[];
65
- export declare function resolve<T>(type: Class<T>, options?: unknown[] | boolean, check?: boolean): T extends AsyncService ? Promise<T> : T;
66
- export declare function resolve<T>(type: TypedArray<T>, options?: unknown[] | boolean, check?: boolean): T extends AsyncService ? Promise<T[]> : T[];
67
- /**
68
- * Gets already resolved service from root container.
69
- *
70
- * @param serviceName - name of service to get
71
- */
72
- export declare function get<T>(serviceName: TypedArray<T>): T[] | null;
73
- export declare function get<T>(serviceName: string | Class<T>): T | null;
74
- /**
75
- *
76
- * Returns list of types registered at given type, eg. all types/services registered under BaseService
77
- *
78
- * @param type - base type to check
79
- */
80
- export declare function getRegisteredTypes<T>(type: string | Class<T>): Class<T>[];
81
- /**
82
- * Checks if service is already resolved and exists in container cache.
83
- * NOTE: check is only valid for classes that are singletons.
84
- *
85
- * @param service - service name or class to check
86
- */
87
- export declare function has<T>(service: string | Class<T>): boolean;
88
- /**
89
- * Checks if service is registered in container.
90
- *
91
- * @param service - service class object to check
92
- */
93
- export declare function check<T>(service: Class<T> | string): boolean;
94
- /**
95
- * Checks if specific service is registered in container.
96
- * Eg. we can have multiple drivers registered for queue connections with different protocol implementations
97
- * and we want to check if specific driver is registered
98
- *
99
- * @param source - source class to check ( eg. base class )
100
- * @param type - specific type to check eg. base class implementation
101
- */
102
- export declare function checkType<T>(source: Class<any> | string | TypedArray<any>, type: Class<T> | string | TypedArray<T> | object): boolean;
103
- /**
104
- * Creates child DI container.
105
- *
106
- */
107
- export declare function child(): IContainer;
108
- export declare function __spinajs_require__(module: string): Promise<unknown>;
1
+ import { IBind, IContainer, AsyncService, ResolvableObject } from './interfaces.js';
2
+ import { Class, Factory } from './types.js';
3
+ import { TypedArray } from './array.js';
4
+ /**
5
+ * App main DI container
6
+ */
7
+ export declare const RootContainer: IContainer;
8
+ /***
9
+ * EVENT LISTENER STUFF
10
+ *
11
+ * Allows to use event listener stuff on root container
12
+ */
13
+ export declare function setESMModuleSupport(): void;
14
+ export declare function on(event: string, listener: (...args: unknown[]) => void): IContainer;
15
+ export declare function addListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
16
+ export declare function once(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
17
+ export declare function removeListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
18
+ export declare function off(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
19
+ export declare function removeAllListeners(event?: string | symbol): IContainer;
20
+ export declare function setMaxListeners(n: number): IContainer;
21
+ export declare function getMaxListeners(): number;
22
+ export declare function listeners(event: string | symbol): Function[];
23
+ export declare function rawListeners(event: string | symbol): Function[];
24
+ export declare function emit(event: string | symbol, ...args: unknown[]): boolean;
25
+ export declare function listenerCount(type: string | symbol): number;
26
+ export declare function prependListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
27
+ export declare function prependOnceListener(event: string | symbol, listener: (...args: unknown[]) => void): IContainer;
28
+ export declare function eventNames(): (string | symbol)[];
29
+ /**
30
+ * ===========================================================================
31
+ */
32
+ /**
33
+ * Clears root container registry and cache.
34
+ */
35
+ export declare function clear(): void;
36
+ /**
37
+ * Clears out root registry ( registered types in root container )
38
+ */
39
+ export declare function clearRegistry(): void;
40
+ /**
41
+ * Cleart ous root cache ( all resolved types )
42
+ */
43
+ export declare function clearCache(): void;
44
+ export declare function dispose(): Promise<void>;
45
+ /**
46
+ * Register class/interface to DI root container. If
47
+ * @param type - interface object to register
48
+ * @throws {@link InvalidArgument} if type is null or undefined
49
+ */
50
+ export declare function register<T>(type: Class<T> | Factory<T> | ResolvableObject): IBind;
51
+ export declare function unregister<T>(type: string | Class<T> | Factory<T> | ResolvableObject): void;
52
+ export declare function uncache<T>(type: string | Class<T> | TypedArray<T>, parent?: boolean): void;
53
+ /**
54
+ * Resolves specified type from root container.
55
+ *
56
+ * @param type - class to resolve
57
+ * @param options - optional parameters passed to class constructor
58
+ * @param check - use parent container to check when resolving
59
+ * @throws {@link InvalidArgument} if type is null or undefined
60
+ */
61
+ export declare function resolve<T>(type: string, options?: unknown[], check?: boolean): T;
62
+ export declare function resolve<T>(type: string, check?: boolean): T;
63
+ export declare function resolve<T>(type: Class<T>, check?: boolean): T extends AsyncService ? Promise<T> : T;
64
+ export declare function resolve<T>(type: TypedArray<T>, check?: boolean): T extends AsyncService ? Promise<T[]> : T[];
65
+ export declare function resolve<T>(type: Class<T>, options?: unknown[] | boolean, check?: boolean): T extends AsyncService ? Promise<T> : T;
66
+ export declare function resolve<T>(type: TypedArray<T>, options?: unknown[] | boolean, check?: boolean): T extends AsyncService ? Promise<T[]> : T[];
67
+ /**
68
+ * Gets already resolved service from root container.
69
+ *
70
+ * @param serviceName - name of service to get
71
+ */
72
+ export declare function get<T>(serviceName: TypedArray<T>): T[] | null;
73
+ export declare function get<T>(serviceName: string | Class<T>): T | null;
74
+ /**
75
+ *
76
+ * Returns list of types registered at given type, eg. all types/services registered under BaseService
77
+ *
78
+ * @param type - base type to check
79
+ */
80
+ export declare function getRegisteredTypes<T>(type: string | Class<T>): Class<T>[];
81
+ /**
82
+ * Checks if service is already resolved and exists in container cache.
83
+ * NOTE: check is only valid for classes that are singletons.
84
+ *
85
+ * @param service - service name or class to check
86
+ */
87
+ export declare function has<T>(service: string | Class<T>): boolean;
88
+ /**
89
+ * Checks if service is registered in container.
90
+ *
91
+ * @param service - service class object to check
92
+ */
93
+ export declare function check<T>(service: Class<T> | string): boolean;
94
+ /**
95
+ * Checks if specific service is registered in container.
96
+ * Eg. we can have multiple drivers registered for queue connections with different protocol implementations
97
+ * and we want to check if specific driver is registered
98
+ *
99
+ * @param source - source class to check ( eg. base class )
100
+ * @param type - specific type to check eg. base class implementation
101
+ */
102
+ export declare function checkType<T>(source: Class<any> | string | TypedArray<any>, type: Class<T> | string | TypedArray<T> | object): boolean;
103
+ /**
104
+ * Creates child DI container.
105
+ *
106
+ */
107
+ export declare function child(): IContainer;
108
+ export declare function __spinajs_require__(module: string): Promise<unknown>;
109
109
  //# sourceMappingURL=root.d.ts.map
package/lib/mjs/root.js CHANGED
@@ -1,160 +1,160 @@
1
- import { Container } from './container.js';
2
- /**
3
- * App main DI container
4
- */
5
- export const RootContainer = new Container();
6
- /***
7
- * EVENT LISTENER STUFF
8
- *
9
- * Allows to use event listener stuff on root container
10
- */
11
- export function setESMModuleSupport() {
12
- RootContainer.register({
13
- mjs: true,
14
- }).asValue('__esmMode__');
15
- }
16
- export function on(event, listener) {
17
- return RootContainer.on(event, listener);
18
- }
19
- export function addListener(event, listener) {
20
- return RootContainer.addListener(event, listener);
21
- }
22
- export function once(event, listener) {
23
- return RootContainer.once(event, listener);
24
- }
25
- export function removeListener(event, listener) {
26
- return RootContainer.removeListener(event, listener);
27
- }
28
- export function off(event, listener) {
29
- return RootContainer.off(event, listener);
30
- }
31
- export function removeAllListeners(event) {
32
- return RootContainer.removeAllListeners(event);
33
- }
34
- export function setMaxListeners(n) {
35
- return RootContainer.setMaxListeners(n);
36
- }
37
- export function getMaxListeners() {
38
- return RootContainer.getMaxListeners();
39
- }
40
- export function listeners(event) {
41
- return RootContainer.listeners(event);
42
- }
43
- export function rawListeners(event) {
44
- return RootContainer.rawListeners(event);
45
- }
46
- export function emit(event, ...args) {
47
- return RootContainer.emit(event, ...args);
48
- }
49
- export function listenerCount(type) {
50
- return RootContainer.listenerCount(type);
51
- }
52
- export function prependListener(event, listener) {
53
- return RootContainer.prependListener(event, listener);
54
- }
55
- export function prependOnceListener(event, listener) {
56
- return RootContainer.prependOnceListener(event, listener);
57
- }
58
- export function eventNames() {
59
- return RootContainer.eventNames();
60
- }
61
- /**
62
- * ===========================================================================
63
- */
64
- /**
65
- * Clears root container registry and cache.
66
- */
67
- export function clear() {
68
- RootContainer.clearCache();
69
- RootContainer.clearRegistry();
70
- }
71
- /**
72
- * Clears out root registry ( registered types in root container )
73
- */
74
- export function clearRegistry() {
75
- RootContainer.clearRegistry();
76
- }
77
- /**
78
- * Cleart ous root cache ( all resolved types )
79
- */
80
- export function clearCache() {
81
- RootContainer.clearCache();
82
- }
83
- export async function dispose() {
84
- await RootContainer.dispose();
85
- }
86
- /**
87
- * Register class/interface to DI root container. If
88
- * @param type - interface object to register
89
- * @throws {@link InvalidArgument} if type is null or undefined
90
- */
91
- export function register(type) {
92
- return RootContainer.register(type);
93
- }
94
- export function unregister(type) {
95
- RootContainer.unregister(type);
96
- }
97
- export function uncache(type, parent) {
98
- RootContainer.uncache(type, parent);
99
- }
100
- export function resolve(type, options, check) {
101
- return RootContainer.resolve(type, options, check);
102
- }
103
- export function get(serviceName) {
104
- return RootContainer.get(serviceName);
105
- }
106
- /**
107
- *
108
- * Returns list of types registered at given type, eg. all types/services registered under BaseService
109
- *
110
- * @param type - base type to check
111
- */
112
- export function getRegisteredTypes(type) {
113
- return RootContainer.getRegisteredTypes(type);
114
- }
115
- /**
116
- * Checks if service is already resolved and exists in container cache.
117
- * NOTE: check is only valid for classes that are singletons.
118
- *
119
- * @param service - service name or class to check
120
- */
121
- export function has(service) {
122
- return RootContainer.isResolved(service);
123
- }
124
- /**
125
- * Checks if service is registered in container.
126
- *
127
- * @param service - service class object to check
128
- */
129
- export function check(service) {
130
- return RootContainer.hasRegistered(service);
131
- }
132
- /**
133
- * Checks if specific service is registered in container.
134
- * Eg. we can have multiple drivers registered for queue connections with different protocol implementations
135
- * and we want to check if specific driver is registered
136
- *
137
- * @param source - source class to check ( eg. base class )
138
- * @param type - specific type to check eg. base class implementation
139
- */
140
- export function checkType(source, type) {
141
- return RootContainer.hasRegisteredType(source, type);
142
- }
143
- /**
144
- * Creates child DI container.
145
- *
146
- */
147
- export function child() {
148
- return RootContainer.child();
149
- }
150
- export async function __spinajs_require__(module) {
151
- const isESM = RootContainer.get('__esmMode__');
152
- if (isESM && isESM.mjs) {
153
- const result = await import(`file://${module}`);
154
- return result.default ?? result;
155
- }
156
- else {
157
- return Promise.resolve(require(module));
158
- }
159
- }
1
+ import { Container } from './container.js';
2
+ /**
3
+ * App main DI container
4
+ */
5
+ export const RootContainer = new Container();
6
+ /***
7
+ * EVENT LISTENER STUFF
8
+ *
9
+ * Allows to use event listener stuff on root container
10
+ */
11
+ export function setESMModuleSupport() {
12
+ RootContainer.register({
13
+ mjs: true,
14
+ }).asValue('__esmMode__');
15
+ }
16
+ export function on(event, listener) {
17
+ return RootContainer.on(event, listener);
18
+ }
19
+ export function addListener(event, listener) {
20
+ return RootContainer.addListener(event, listener);
21
+ }
22
+ export function once(event, listener) {
23
+ return RootContainer.once(event, listener);
24
+ }
25
+ export function removeListener(event, listener) {
26
+ return RootContainer.removeListener(event, listener);
27
+ }
28
+ export function off(event, listener) {
29
+ return RootContainer.off(event, listener);
30
+ }
31
+ export function removeAllListeners(event) {
32
+ return RootContainer.removeAllListeners(event);
33
+ }
34
+ export function setMaxListeners(n) {
35
+ return RootContainer.setMaxListeners(n);
36
+ }
37
+ export function getMaxListeners() {
38
+ return RootContainer.getMaxListeners();
39
+ }
40
+ export function listeners(event) {
41
+ return RootContainer.listeners(event);
42
+ }
43
+ export function rawListeners(event) {
44
+ return RootContainer.rawListeners(event);
45
+ }
46
+ export function emit(event, ...args) {
47
+ return RootContainer.emit(event, ...args);
48
+ }
49
+ export function listenerCount(type) {
50
+ return RootContainer.listenerCount(type);
51
+ }
52
+ export function prependListener(event, listener) {
53
+ return RootContainer.prependListener(event, listener);
54
+ }
55
+ export function prependOnceListener(event, listener) {
56
+ return RootContainer.prependOnceListener(event, listener);
57
+ }
58
+ export function eventNames() {
59
+ return RootContainer.eventNames();
60
+ }
61
+ /**
62
+ * ===========================================================================
63
+ */
64
+ /**
65
+ * Clears root container registry and cache.
66
+ */
67
+ export function clear() {
68
+ RootContainer.clearCache();
69
+ RootContainer.clearRegistry();
70
+ }
71
+ /**
72
+ * Clears out root registry ( registered types in root container )
73
+ */
74
+ export function clearRegistry() {
75
+ RootContainer.clearRegistry();
76
+ }
77
+ /**
78
+ * Cleart ous root cache ( all resolved types )
79
+ */
80
+ export function clearCache() {
81
+ RootContainer.clearCache();
82
+ }
83
+ export async function dispose() {
84
+ await RootContainer.dispose();
85
+ }
86
+ /**
87
+ * Register class/interface to DI root container. If
88
+ * @param type - interface object to register
89
+ * @throws {@link InvalidArgument} if type is null or undefined
90
+ */
91
+ export function register(type) {
92
+ return RootContainer.register(type);
93
+ }
94
+ export function unregister(type) {
95
+ RootContainer.unregister(type);
96
+ }
97
+ export function uncache(type, parent) {
98
+ RootContainer.uncache(type, parent);
99
+ }
100
+ export function resolve(type, options, check) {
101
+ return RootContainer.resolve(type, options, check);
102
+ }
103
+ export function get(serviceName) {
104
+ return RootContainer.get(serviceName);
105
+ }
106
+ /**
107
+ *
108
+ * Returns list of types registered at given type, eg. all types/services registered under BaseService
109
+ *
110
+ * @param type - base type to check
111
+ */
112
+ export function getRegisteredTypes(type) {
113
+ return RootContainer.getRegisteredTypes(type);
114
+ }
115
+ /**
116
+ * Checks if service is already resolved and exists in container cache.
117
+ * NOTE: check is only valid for classes that are singletons.
118
+ *
119
+ * @param service - service name or class to check
120
+ */
121
+ export function has(service) {
122
+ return RootContainer.isResolved(service);
123
+ }
124
+ /**
125
+ * Checks if service is registered in container.
126
+ *
127
+ * @param service - service class object to check
128
+ */
129
+ export function check(service) {
130
+ return RootContainer.hasRegistered(service);
131
+ }
132
+ /**
133
+ * Checks if specific service is registered in container.
134
+ * Eg. we can have multiple drivers registered for queue connections with different protocol implementations
135
+ * and we want to check if specific driver is registered
136
+ *
137
+ * @param source - source class to check ( eg. base class )
138
+ * @param type - specific type to check eg. base class implementation
139
+ */
140
+ export function checkType(source, type) {
141
+ return RootContainer.hasRegisteredType(source, type);
142
+ }
143
+ /**
144
+ * Creates child DI container.
145
+ *
146
+ */
147
+ export function child() {
148
+ return RootContainer.child();
149
+ }
150
+ export async function __spinajs_require__(module) {
151
+ const isESM = RootContainer.get('__esmMode__');
152
+ if (isESM && isESM.mjs) {
153
+ const result = await import(`file://${module}`);
154
+ return result.default ?? result;
155
+ }
156
+ else {
157
+ return Promise.resolve(require(module));
158
+ }
159
+ }
160
160
  //# sourceMappingURL=root.js.map
@@ -1,14 +1,14 @@
1
- import { IContainer } from './interfaces.js';
2
- export type Abstract<T> = Function & {
3
- prototype: T;
4
- };
5
- export type Constructor<T> = new (...args: any[]) => T;
6
- export type Class<T> = Abstract<T> | Constructor<T>;
7
- /**
8
- * Factory functions should not be normal functions,
9
- * but arrow functions. Its is by js limitation
10
- * to detect if object is constructable
11
- */
12
- export type Factory<T> = (container: IContainer, ...args: any[]) => T;
13
- export type ClassArray<T> = Class<T>[];
1
+ import { IContainer } from './interfaces.js';
2
+ export type Abstract<T> = Function & {
3
+ prototype: T;
4
+ };
5
+ export type Constructor<T> = new (...args: any[]) => T;
6
+ export type Class<T> = Abstract<T> | Constructor<T>;
7
+ /**
8
+ * Factory functions should not be normal functions,
9
+ * but arrow functions. Its is by js limitation
10
+ * to detect if object is constructable
11
+ */
12
+ export type Factory<T> = (container: IContainer, ...args: any[]) => T;
13
+ export type ClassArray<T> = Class<T>[];
14
14
  //# sourceMappingURL=types.d.ts.map
package/lib/mjs/types.js CHANGED
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map