@azrico/webobject 1.2.8 → 1.2.9
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,8 +1,4 @@
|
|
|
1
|
-
declare type
|
|
2
|
-
declare type constructorResult<T> = T;
|
|
3
|
-
interface constructorObject<S> {
|
|
4
|
-
new (p: constructorInput<S>): S;
|
|
5
|
-
}
|
|
1
|
+
declare type FirstInTuple<T extends any[]> = ((...args: T) => any) extends (arg: infer R, ...rest: infer U) => any ? R : T;
|
|
6
2
|
/**
|
|
7
3
|
* This object can be mapped and converted
|
|
8
4
|
*/
|
|
@@ -14,10 +10,29 @@ export declare class MapableObject {
|
|
|
14
10
|
constructor();
|
|
15
11
|
static mapto<T>(maptoType: {
|
|
16
12
|
new (...p: any): T;
|
|
17
|
-
}, objectlist: any[] | null | undefined,
|
|
18
|
-
static mapto<T extends typeof MapableObject>(objectlist: any[] | null | undefined,
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
}, objectlist: any[] | null | undefined, is_readonly?: boolean, ...p: any[]): T[];
|
|
14
|
+
static mapto<T extends typeof MapableObject>(objectlist: any[] | null | undefined, is_readonly?: boolean, ...p: any[]): InstanceType<T>[];
|
|
15
|
+
/**
|
|
16
|
+
* construct a new class from the given first parameter
|
|
17
|
+
* @param maptoType class
|
|
18
|
+
* @param first_param first parameter
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
static ensure<ClassType extends new (...args: any) => any>(maptoType: ClassType, first_param: FirstInTuple<ConstructorParameters<ClassType>>): InstanceType<ClassType>;
|
|
22
|
+
/**
|
|
23
|
+
* construct a new class from the given parameters
|
|
24
|
+
* @param maptoType class
|
|
25
|
+
* @param first_param first parameter
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
static ensure<ClassType extends new (...args: any) => any>(maptoType: ClassType, ...rest_params: ConstructorParameters<ClassType>): InstanceType<ClassType>;
|
|
29
|
+
/**
|
|
30
|
+
* make sure the object is instance of class
|
|
31
|
+
* @param maptoType class
|
|
32
|
+
* @param obj
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
static ensure<ClassType extends new (...args: any) => any>(maptoType: ClassType, obj: InstanceType<ClassType>): InstanceType<ClassType>;
|
|
21
36
|
static map_rowindex<T extends MapableObject>(objectlist: T[] | null | undefined): T[];
|
|
22
37
|
static map_tableid<T extends MapableObject>(objectlist: T[] | null | undefined): T[];
|
|
23
38
|
static equals(a?: MapableObject | any, b?: MapableObject | any): boolean;
|