@lppedd/di-wise-neo 0.26.1 → 0.26.3
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.
- package/dist/cjs/index.d.ts +42 -7
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.d.mts +42 -7
- package/dist/es/index.mjs +0 -1
- package/dist/es/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -75,10 +75,6 @@ interface Type<T> extends ParameterDecorator {
|
|
|
75
75
|
* An injectable type `T` with a default {@link Provider} and optional default registration options.
|
|
76
76
|
*/
|
|
77
77
|
interface ProviderType<T> extends Type<T> {
|
|
78
|
-
/**
|
|
79
|
-
* The underlying `Type<T>`.
|
|
80
|
-
*/
|
|
81
|
-
readonly type: Type<T>;
|
|
82
78
|
/**
|
|
83
79
|
* The type's default provider.
|
|
84
80
|
*/
|
|
@@ -116,11 +112,23 @@ type Tokens<Value> = [Token<Value>, ...Token<Value>[]];
|
|
|
116
112
|
*/
|
|
117
113
|
declare function createType<T>(debugName: string): Type<T>;
|
|
118
114
|
/**
|
|
119
|
-
* Creates a type token with a default {@link
|
|
115
|
+
* Creates a type token with a default {@link ClassProvider} and optional default registration options.
|
|
116
|
+
*
|
|
117
|
+
* Example:
|
|
118
|
+
* ```ts
|
|
119
|
+
* const ISpell = createType<Spell>("Spell", {
|
|
120
|
+
* useClass: DefaultSpell,
|
|
121
|
+
* });
|
|
122
|
+
*
|
|
123
|
+
* container.register(ISpell);
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
declare function createType<T extends object>(debugName: string, provider: ClassProvider<T>, options?: RegistrationOptions): ProviderType<T>;
|
|
127
|
+
/**
|
|
128
|
+
* Creates a type token with a default {@link FactoryProvider} and optional default registration options.
|
|
120
129
|
*
|
|
121
130
|
* Example:
|
|
122
131
|
* ```ts
|
|
123
|
-
* // Notice how we pass in a Provider directly at type creation site
|
|
124
132
|
* const ISpell = createType<Spell>("Spell", {
|
|
125
133
|
* useFactory: () => getDefaultSpell(),
|
|
126
134
|
* });
|
|
@@ -128,7 +136,34 @@ declare function createType<T>(debugName: string): Type<T>;
|
|
|
128
136
|
* container.register(ISpell);
|
|
129
137
|
* ```
|
|
130
138
|
*/
|
|
131
|
-
declare function createType<T>(debugName: string, provider:
|
|
139
|
+
declare function createType<T>(debugName: string, provider: FactoryProvider<T>, options?: RegistrationOptions): ProviderType<T>;
|
|
140
|
+
/**
|
|
141
|
+
* Creates a type token with a default {@link ValueProvider} and optional default registration options.
|
|
142
|
+
*
|
|
143
|
+
* Example:
|
|
144
|
+
* ```ts
|
|
145
|
+
* const defaultSpell = getDefaultSpell();
|
|
146
|
+
* const ISpell = createType<Spell>("Spell", {
|
|
147
|
+
* useValue: defaultSpell,
|
|
148
|
+
* });
|
|
149
|
+
*
|
|
150
|
+
* container.register(ISpell);
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
declare function createType<T>(debugName: string, provider: ValueProvider<T>, options?: RegistrationOptions): ProviderType<T>;
|
|
154
|
+
/**
|
|
155
|
+
* Creates a type token with a default {@link ExistingProvider} and optional default registration options.
|
|
156
|
+
*
|
|
157
|
+
* Example:
|
|
158
|
+
* ```ts
|
|
159
|
+
* const ISpell = createType<Spell>("Spell", {
|
|
160
|
+
* useExisting: IBaseSpell,
|
|
161
|
+
* });
|
|
162
|
+
*
|
|
163
|
+
* container.register(ISpell);
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
declare function createType<T>(debugName: string, provider: ExistingProvider<T>, options?: RegistrationOptions): ProviderType<T>;
|
|
132
167
|
|
|
133
168
|
interface ClassRef<Instance extends object> {
|
|
134
169
|
readonly getRefClass: () => Constructor<Instance>;
|