@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.
@@ -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 Provider} and optional default registration options.
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: Provider<T>, options?: RegistrationOptions): ProviderType<T>;
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>;
package/dist/cjs/index.js CHANGED
@@ -453,7 +453,6 @@ function createType(debugName, provider, options) {
453
453
  type.__type = undefined;
454
454
  type.toString = ()=>name;
455
455
  if (provider) {
456
- type.type = type;
457
456
  type.provider = provider;
458
457
  type.options = options;
459
458
  }