nano-injector 1.0.3 → 1.0.5

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.
@@ -1,50 +1,48 @@
1
- export declare type ProviderValueType<T extends Provider<any>> = T extends Provider<infer R> ? R : never;
2
- /**
3
- * Symbol used for storing the id of a provider
4
- */
5
- declare const ID_SYMBOL: unique symbol;
6
- /**
7
- * Symbol used for storing the name of a provider
8
- */
9
- declare const NAME_SYMBOL: unique symbol;
10
- /**
11
- * Provider is a second main concept in the library. Basically just it is just a function
12
- * through which binding with the specific value occurs.
13
- */
14
- export interface Provider<T> {
15
- readonly [ID_SYMBOL]: number;
16
- readonly [NAME_SYMBOL]: string;
17
- /**
18
- * Returns bound to this provider value. Throws the exception if it's not found.
19
- * If throwing the exception is not desired any value to the provider should
20
- * be passed
21
- */
22
- (): T;
23
- /**
24
- * Returns bound to this provider value. Returns default one if the bound value
25
- * is not found
26
- * @param defValue
27
- */
28
- <DefValT>(defValue: DefValT): T | DefValT;
29
- }
30
- /**
31
- * Creates the new provider for some value with a specific type
32
- * @param name name for this provider used mainly for debugging purposes
33
- */
34
- export declare function createProvider<T>(name?: string): Provider<T>;
35
- /**
36
- * Determines whether the received value is a provider
37
- * @param value value which should be tested
38
- */
39
- export declare function isProvider<T = unknown>(value: unknown): value is Provider<T>;
40
- /**
41
- * Returns the id of the specified provider
42
- * @param provider
43
- */
44
- export declare function getProviderID(provider: Provider<unknown>): number;
45
- /**
46
- * Returns the name of the specified provider
47
- * @param provider
48
- */
49
- export declare function getProviderName(provider: Provider<unknown>): string | undefined;
50
- export {};
1
+ export type ProviderValueType<T extends Provider<any>> = T extends Provider<infer R> ? R : never;
2
+ /**
3
+ * Symbol used to store the unique ID of a provider.
4
+ */
5
+ declare const ID_SYMBOL: unique symbol;
6
+ /**
7
+ * Symbol used for storing the name of a provider
8
+ */
9
+ declare const NAME_SYMBOL: unique symbol;
10
+ /**
11
+ * A Provider is a core concept in the library. It is essentially a function
12
+ * that facilitates binding to a specific value.
13
+ */
14
+ export interface Provider<T> {
15
+ readonly [ID_SYMBOL]: number;
16
+ readonly [NAME_SYMBOL]?: string;
17
+ /**
18
+ * Returns the value bound to this provider. Throws an exception if the value is not found.
19
+ * To avoid an exception, pass a default value.
20
+ */
21
+ (): T;
22
+ /**
23
+ * Returns the value bound to this provider, or the default value if the bound value is not found.
24
+ * @param defValue
25
+ */
26
+ <DefValT>(defValue: DefValT): T | DefValT;
27
+ }
28
+ /**
29
+ * Creates a new provider for a specific value type.
30
+ * @param name name for this provider used mainly for debugging purposes
31
+ */
32
+ export declare function createProvider<T>(name?: string): Provider<T>;
33
+ /**
34
+ * Determines whether the given value is a provider.
35
+ * @param value value which should be tested
36
+ */
37
+ export declare function isProvider<T = unknown>(value: unknown): value is Provider<T>;
38
+ /**
39
+ * Returns the unique ID of the specified provider.
40
+ * @param provider
41
+ */
42
+ export declare function getProviderID(provider: Provider<unknown>): number;
43
+ /**
44
+ * Returns the name of the specified provider
45
+ * @param provider
46
+ */
47
+ export declare function getProviderName(provider: Provider<unknown>): string | undefined;
48
+ export {};
@@ -1,2 +1,2 @@
1
- export * from './Injector';
2
- export * from './Provider';
1
+ export * from './Injector';
2
+ export * from './Provider';