as-model 0.1.11 → 0.1.12
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/index.d.ts +14 -14
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
declare interface ModelInstance {
|
|
2
|
-
[key: string]:
|
|
3
|
-
[key: number]:
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
[key: number]: any;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
declare type ValidInstance<S, T extends ModelInstance> = {
|
|
7
|
-
[K in keyof T]: T[K] extends (...args:
|
|
7
|
+
[K in keyof T]: T[K] extends (...args: any[]) => S
|
|
8
8
|
? T[K]
|
|
9
|
-
: T[K] extends (...args:
|
|
9
|
+
: T[K] extends (...args: any[]) => any
|
|
10
10
|
? never
|
|
11
11
|
: T[K];
|
|
12
12
|
};
|
|
@@ -25,7 +25,7 @@ export declare type Action<S = any, T extends ModelInstance = ModelInstance> = {
|
|
|
25
25
|
prevInstance?: T;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
declare type Dispatch = (action: Action) =>
|
|
28
|
+
declare type Dispatch = (action: Action) => any;
|
|
29
29
|
|
|
30
30
|
export declare interface Key<
|
|
31
31
|
S = any,
|
|
@@ -154,8 +154,8 @@ export declare interface ModelUsage<
|
|
|
154
154
|
|
|
155
155
|
declare type FieldStructure<R = any> = {
|
|
156
156
|
callback: () => R;
|
|
157
|
-
deps:
|
|
158
|
-
identifier: (d:
|
|
157
|
+
deps: any[] | undefined;
|
|
158
|
+
identifier: (d: any) => d is FieldStructure<R>;
|
|
159
159
|
value: R;
|
|
160
160
|
get: () => R;
|
|
161
161
|
};
|
|
@@ -163,7 +163,7 @@ declare type FieldStructure<R = any> = {
|
|
|
163
163
|
declare type MethodStructure<
|
|
164
164
|
R extends (...args: any[]) => any = (...args: any[]) => any
|
|
165
165
|
> = R & {
|
|
166
|
-
identifier: (d:
|
|
166
|
+
identifier: (d: any) => d is MethodStructure;
|
|
167
167
|
};
|
|
168
168
|
|
|
169
169
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -178,7 +178,7 @@ export declare interface model {
|
|
|
178
178
|
): ModelUsage<S, T, R>;
|
|
179
179
|
createField: <P extends () => any>(
|
|
180
180
|
callback: P,
|
|
181
|
-
deps?:
|
|
181
|
+
deps?: any[]
|
|
182
182
|
) => FieldStructure<ReturnType<P>>;
|
|
183
183
|
createMethod: <P extends (...args: any[]) => any = (...args: any[]) => any>(
|
|
184
184
|
method: P
|
|
@@ -268,29 +268,29 @@ export declare function config(configuration: Config): {
|
|
|
268
268
|
|
|
269
269
|
/** validations * */
|
|
270
270
|
export declare const validations: {
|
|
271
|
-
isInstanceFromNoStateModel: (instance:
|
|
271
|
+
isInstanceFromNoStateModel: (instance: any) => boolean;
|
|
272
272
|
isModelKey: <
|
|
273
273
|
S,
|
|
274
274
|
T extends ModelInstance,
|
|
275
275
|
R extends (ins: () => T) => any = (ins: () => T) => T
|
|
276
276
|
>(
|
|
277
|
-
data:
|
|
277
|
+
data: any
|
|
278
278
|
) => data is ModelKey<S, T, R>;
|
|
279
279
|
isModelStore: <
|
|
280
280
|
S,
|
|
281
281
|
T extends ModelInstance,
|
|
282
282
|
R extends (ins: () => T) => any = (ins: () => T) => T
|
|
283
283
|
>(
|
|
284
|
-
data:
|
|
284
|
+
data: any
|
|
285
285
|
) => data is Store<S, T, R>;
|
|
286
286
|
isModelUsage: <
|
|
287
287
|
S,
|
|
288
288
|
T extends ModelInstance,
|
|
289
289
|
R extends (ins: () => T) => any = (ins: () => T) => T
|
|
290
290
|
>(
|
|
291
|
-
data:
|
|
291
|
+
data: any
|
|
292
292
|
) => data is ModelUsage<S, T, R>;
|
|
293
293
|
};
|
|
294
294
|
|
|
295
295
|
/** tools * */
|
|
296
|
-
export declare function shallowEqual(prev:
|
|
296
|
+
export declare function shallowEqual(prev: any, current: any): boolean;
|