@nestia/fetcher 4.0.0-dev.20241010-2 → 4.0.0-dev.20241021-2

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,6 +1,6 @@
1
+ import { IRandomGenerator } from "typia";
1
2
  import { IEncryptionPassword } from "./IEncryptionPassword";
2
3
  import { IFetchEvent } from "./IFetchEvent";
3
- import { IRandomGenerator } from "./IRandomGenerator";
4
4
  /**
5
5
  * Connection information.
6
6
  *
package/lib/index.d.ts CHANGED
@@ -5,6 +5,3 @@ export * from "./IEncryptionPassword";
5
5
  export * from "./IFetchEvent";
6
6
  export * from "./IFetchRoute";
7
7
  export * from "./IPropagation";
8
- export * from "./IRandomGenerator";
9
- export * from "./Primitive";
10
- export * from "./Resolved";
package/lib/index.js CHANGED
@@ -21,7 +21,4 @@ __exportStar(require("./IEncryptionPassword"), exports);
21
21
  __exportStar(require("./IFetchEvent"), exports);
22
22
  __exportStar(require("./IFetchRoute"), exports);
23
23
  __exportStar(require("./IPropagation"), exports);
24
- __exportStar(require("./IRandomGenerator"), exports);
25
- __exportStar(require("./Primitive"), exports);
26
- __exportStar(require("./Resolved"), exports);
27
24
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,8CAA4B;AAC5B,gDAA8B;AAC9B,wDAAsC;AACtC,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAC/B,qDAAmC;AACnC,8CAA4B;AAC5B,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,8CAA4B;AAC5B,gDAA8B;AAC9B,wDAAsC;AACtC,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/fetcher",
3
- "version": "4.0.0-dev.20241010-2",
3
+ "version": "4.0.0-dev.20241021-2",
4
4
  "description": "Fetcher library of Nestia SDK",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -26,7 +26,8 @@
26
26
  },
27
27
  "homepage": "https://nestia.io",
28
28
  "dependencies": {
29
- "@samchon/openapi": "^1.1.0"
29
+ "@samchon/openapi": "^1.1.0",
30
+ "typia": "^7.0.0-dev.20241021-2"
30
31
  },
31
32
  "peerDependencies": {
32
33
  "typescript": ">= 4.8.0"
@@ -36,7 +37,8 @@
36
37
  "@typescript-eslint/eslint-plugin": "^5.46.1",
37
38
  "@typescript-eslint/parser": "^5.46.1",
38
39
  "rimraf": "^3.0.2",
39
- "typescript": "5.5.4"
40
+ "typescript": "5.5.4",
41
+ "typia": ">=7.0.0-dev.20241021-2 <8.0.0"
40
42
  },
41
43
  "files": [
42
44
  "README.md",
@@ -1,7 +1,8 @@
1
1
  /// <reference lib="dom" />
2
+ import { IRandomGenerator } from "typia";
3
+
2
4
  import { IEncryptionPassword } from "./IEncryptionPassword";
3
5
  import { IFetchEvent } from "./IFetchEvent";
4
- import { IRandomGenerator } from "./IRandomGenerator";
5
6
 
6
7
  /**
7
8
  * Connection information.
package/src/index.ts CHANGED
@@ -5,6 +5,3 @@ export * from "./IEncryptionPassword";
5
5
  export * from "./IFetchEvent";
6
6
  export * from "./IFetchRoute";
7
7
  export * from "./IPropagation";
8
- export * from "./IRandomGenerator";
9
- export * from "./Primitive";
10
- export * from "./Resolved";
@@ -1,32 +0,0 @@
1
- export interface IRandomGenerator {
2
- boolean(): boolean;
3
- integer(minimum?: number, maximum?: number): number;
4
- number(minimum?: number, maximum?: number): number;
5
- bigint(minimum?: bigint, maximum?: bigint): bigint;
6
- string(length?: number): string;
7
- array<T>(closure: (index: number) => T, count?: number): T[];
8
- length(): number;
9
- uuid(): string;
10
- email(): string;
11
- url(): string;
12
- ipv4(): string;
13
- ipv6(): string;
14
- pattern(regex: RegExp): string;
15
- date(minimum?: number, maximum?: number): string;
16
- datetime(minimum?: number, maximum?: number): string;
17
- customs?: IRandomGenerator.CustomMap;
18
- }
19
- export declare namespace IRandomGenerator {
20
- type CustomMap = {
21
- [Type in keyof Customizable]?: (tags: ICommentTag[]) => Customizable[Type] | undefined;
22
- };
23
- type Customizable = {
24
- number: number;
25
- string: string;
26
- bigint: bigint;
27
- };
28
- interface ICommentTag {
29
- name: string;
30
- value?: string;
31
- }
32
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IRandomGenerator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IRandomGenerator.js","sourceRoot":"","sources":["../src/IRandomGenerator.ts"],"names":[],"mappings":""}
@@ -1,68 +0,0 @@
1
- /**
2
- * Primitive type of JSON.
3
- *
4
- * `Primitive<T>` is a TMP (Type Meta Programming) type which converts
5
- * its argument as a primitive type within framework JSON.
6
- *
7
- * If the target argument is a built-in class which returns its origin primitive type
8
- * through the `valueOf()` method like the `String` or `Number`, its return type would
9
- * be the `string` or `number`. Otherwise, the built-in class does not have the
10
- * `valueOf()` method, the return type would be an empty object (`{}`).
11
- *
12
- * Otherwise, the target argument is a type of custom class, all of its custom method
13
- * would be erased and its prototype would be changed to the primitive `object`.
14
- * Therefore, return type of the TMP type finally be the primitive object.
15
- *
16
- * In addition, if the target argument is a type of custom class and it has a special
17
- * method `toJSON()`, return type of this `Primitive` would be not `Primitive<Instance>`
18
- * but `Primitive<ReturnType<Instance.toJSON>>`.
19
- *
20
- * Before | After
21
- * ------------------------|----------------------------------------
22
- * `Boolean` | `boolean`
23
- * `Number` | `number`
24
- * `String` | `string`
25
- * `Class` | `object`
26
- * `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
27
- * Native Class | never
28
- * Others | No change
29
- *
30
- * @template Instance Target argument type.
31
- * @author Jeongho Nam - https://github.com/samchon
32
- * @author Kyungsu Kang - https://github.com/kakasoo
33
- * @author Michael - https://github.com/8471919
34
- */
35
- export type Primitive<T> = Equal<T, PrimitiveMain<T>> extends true ? T : PrimitiveMain<T>;
36
- type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
37
- type PrimitiveMain<Instance> = Instance extends [never] ? never : ValueOf<Instance> extends bigint ? never : ValueOf<Instance> extends boolean | number | string ? ValueOf<Instance> : Instance extends Function ? never : ValueOf<Instance> extends object ? Instance extends object ? Instance extends Date ? string & FormatDateTime : Instance extends IJsonable<infer Raw> ? ValueOf<Raw> extends object ? Raw extends object ? PrimitiveObject<Raw> : never : ValueOf<Raw> : Instance extends NativeClass ? never : PrimitiveObject<Instance> : never : ValueOf<Instance>;
38
- type PrimitiveObject<Instance extends object> = Instance extends Array<infer T> ? IsTuple<Instance> extends true ? PrimitiveTuple<Instance> : PrimitiveMain<T>[] : {
39
- [P in keyof Instance]: PrimitiveMain<Instance[P]>;
40
- };
41
- type PrimitiveTuple<T extends readonly any[]> = T extends [] ? [] : T extends [infer F] ? [PrimitiveMain<F>] : T extends [infer F, ...infer Rest extends readonly any[]] ? [PrimitiveMain<F>, ...PrimitiveTuple<Rest>] : T extends [(infer F)?] ? [PrimitiveMain<F>?] : T extends [(infer F)?, ...infer Rest extends readonly any[]] ? [PrimitiveMain<F>?, ...PrimitiveTuple<Rest>] : [];
42
- type ValueOf<Instance> = IsValueOf<Instance, Boolean> extends true ? boolean : IsValueOf<Instance, Number> extends true ? number : IsValueOf<Instance, String> extends true ? string : Instance;
43
- type NativeClass = Set<any> | Map<any, any> | WeakSet<any> | WeakMap<any, any> | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array | ArrayBuffer | SharedArrayBuffer | DataView | Blob | File | RegExp;
44
- type IsTuple<T extends readonly any[] | {
45
- length: number;
46
- }> = [T] extends [
47
- never
48
- ] ? false : T extends readonly any[] ? number extends T["length"] ? false : true : false;
49
- type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object ? Object extends IValueOf<infer U> ? Instance extends U ? false : true : false : false;
50
- interface IValueOf<T> {
51
- valueOf(): T;
52
- }
53
- interface IJsonable<T> {
54
- toJSON(): T;
55
- }
56
- type FormatDateTime = {
57
- "typia.tag"?: {
58
- target: "string";
59
- kind: "format";
60
- value: "date-time";
61
- validate: `/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T|\\s)([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i.test($input)`;
62
- exclusive: ["format", "pattern"];
63
- schema: {
64
- format: "date-time";
65
- };
66
- };
67
- };
68
- export {};
package/lib/Primitive.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Primitive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Primitive.js","sourceRoot":"","sources":["../src/Primitive.ts"],"names":[],"mappings":""}
package/lib/Resolved.d.ts DELETED
@@ -1,46 +0,0 @@
1
- /**
2
- * Resolved type erased every methods.
3
- *
4
- * `Resolved` is a type of TMP (Type Meta Programming) type which converts
5
- * its argument as a resolved type that erased every method properties.
6
- *
7
- * If the target argument is a built-in class which returns its origin primitive type
8
- * through the `valueOf()` method like the `String` or `Number`, its return type would
9
- * be the `string` or `number`. Otherwise, the built-in class does not have the
10
- * `valueOf()` method, the return type would be same with the target argument.
11
- *
12
- * Otherwise, the target argument is a type of custom class, all of its custom methods
13
- * would be erased and its prototype would be changed to the primitive `object`.
14
- * Therefore, return type of the TMP type finally be the resolved object.
15
- *
16
- * Before | After
17
- * ------------------------|----------------------------------------
18
- * `Boolean` | `boolean`
19
- * `Number` | `number`
20
- * `BigInt` | `bigint`
21
- * `String` | `string`
22
- * `Class` | `interface`
23
- * Native Class or Others | No change
24
- *
25
- * @template T Target argument type.
26
- * @author Jeongho Nam - https://github.com/samchon
27
- * @author Kyungsu Kang - https://github.com/kakasoo
28
- */
29
- export type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;
30
- type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
31
- type ResolvedMain<T> = T extends [never] ? never : ValueOf<T> extends boolean | number | bigint | string ? ValueOf<T> : T extends Function ? never : T extends object ? ResolvedObject<T> : ValueOf<T>;
32
- type ResolvedObject<T extends object> = T extends Array<infer U> ? IsTuple<T> extends true ? ResolvedTuple<T> : ResolvedMain<U>[] : T extends Set<infer U> ? Set<ResolvedMain<U>> : T extends Map<infer K, infer V> ? Map<ResolvedMain<K>, ResolvedMain<V>> : T extends WeakSet<any> | WeakMap<any, any> ? never : T extends Date | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array | ArrayBuffer | SharedArrayBuffer | DataView | Blob | File | RegExp ? T : {
33
- [P in keyof T]: ResolvedMain<T[P]>;
34
- };
35
- type ResolvedTuple<T extends readonly any[]> = T extends [] ? [] : T extends [infer F] ? [ResolvedMain<F>] : T extends [infer F, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>, ...ResolvedTuple<Rest>] : T extends [(infer F)?] ? [ResolvedMain<F>?] : T extends [(infer F)?, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>] : [];
36
- type IsTuple<T extends readonly any[] | {
37
- length: number;
38
- }> = [T] extends [
39
- never
40
- ] ? false : T extends readonly any[] ? number extends T["length"] ? false : true : false;
41
- type ValueOf<Instance> = IsValueOf<Instance, Boolean> extends true ? boolean : IsValueOf<Instance, Number> extends true ? number : IsValueOf<Instance, String> extends true ? string : Instance;
42
- type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object ? Object extends IValueOf<infer Primitive> ? Instance extends Primitive ? false : true : false : false;
43
- interface IValueOf<T> {
44
- valueOf(): T;
45
- }
46
- export {};
package/lib/Resolved.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Resolved.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Resolved.js","sourceRoot":"","sources":["../src/Resolved.ts"],"names":[],"mappings":""}
@@ -1,38 +0,0 @@
1
- export interface IRandomGenerator {
2
- boolean(): boolean;
3
- integer(minimum?: number, maximum?: number): number;
4
- number(minimum?: number, maximum?: number): number;
5
- bigint(minimum?: bigint, maximum?: bigint): bigint;
6
- string(length?: number): string;
7
- array<T>(closure: (index: number) => T, count?: number): T[];
8
- length(): number;
9
-
10
- uuid(): string;
11
- email(): string;
12
- url(): string;
13
- ipv4(): string;
14
- ipv6(): string;
15
- pattern(regex: RegExp): string;
16
- date(minimum?: number, maximum?: number): string;
17
- datetime(minimum?: number, maximum?: number): string;
18
-
19
- customs?: IRandomGenerator.CustomMap;
20
- }
21
- export namespace IRandomGenerator {
22
- export type CustomMap = {
23
- [Type in keyof Customizable]?: (
24
- tags: ICommentTag[],
25
- ) => Customizable[Type] | undefined;
26
- };
27
-
28
- export type Customizable = {
29
- number: number;
30
- string: string;
31
- bigint: bigint;
32
- };
33
-
34
- export interface ICommentTag {
35
- name: string;
36
- value?: string;
37
- }
38
- }
package/src/Primitive.ts DELETED
@@ -1,154 +0,0 @@
1
- /**
2
- * Primitive type of JSON.
3
- *
4
- * `Primitive<T>` is a TMP (Type Meta Programming) type which converts
5
- * its argument as a primitive type within framework JSON.
6
- *
7
- * If the target argument is a built-in class which returns its origin primitive type
8
- * through the `valueOf()` method like the `String` or `Number`, its return type would
9
- * be the `string` or `number`. Otherwise, the built-in class does not have the
10
- * `valueOf()` method, the return type would be an empty object (`{}`).
11
- *
12
- * Otherwise, the target argument is a type of custom class, all of its custom method
13
- * would be erased and its prototype would be changed to the primitive `object`.
14
- * Therefore, return type of the TMP type finally be the primitive object.
15
- *
16
- * In addition, if the target argument is a type of custom class and it has a special
17
- * method `toJSON()`, return type of this `Primitive` would be not `Primitive<Instance>`
18
- * but `Primitive<ReturnType<Instance.toJSON>>`.
19
- *
20
- * Before | After
21
- * ------------------------|----------------------------------------
22
- * `Boolean` | `boolean`
23
- * `Number` | `number`
24
- * `String` | `string`
25
- * `Class` | `object`
26
- * `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
27
- * Native Class | never
28
- * Others | No change
29
- *
30
- * @template Instance Target argument type.
31
- * @author Jeongho Nam - https://github.com/samchon
32
- * @author Kyungsu Kang - https://github.com/kakasoo
33
- * @author Michael - https://github.com/8471919
34
- */
35
- export type Primitive<T> =
36
- Equal<T, PrimitiveMain<T>> extends true ? T : PrimitiveMain<T>;
37
-
38
- type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
39
-
40
- type PrimitiveMain<Instance> = Instance extends [never]
41
- ? never // (special trick for jsonable | null) type
42
- : ValueOf<Instance> extends bigint
43
- ? never
44
- : ValueOf<Instance> extends boolean | number | string
45
- ? ValueOf<Instance>
46
- : Instance extends Function
47
- ? never
48
- : ValueOf<Instance> extends object
49
- ? Instance extends object
50
- ? Instance extends Date
51
- ? string & FormatDateTime
52
- : Instance extends IJsonable<infer Raw>
53
- ? ValueOf<Raw> extends object
54
- ? Raw extends object
55
- ? PrimitiveObject<Raw> // object would be primitified
56
- : never // cannot be
57
- : ValueOf<Raw> // atomic value
58
- : Instance extends NativeClass
59
- ? never
60
- : PrimitiveObject<Instance> // object would be primitified
61
- : never // cannot be
62
- : ValueOf<Instance>;
63
-
64
- type PrimitiveObject<Instance extends object> =
65
- Instance extends Array<infer T>
66
- ? IsTuple<Instance> extends true
67
- ? PrimitiveTuple<Instance>
68
- : PrimitiveMain<T>[]
69
- : {
70
- [P in keyof Instance]: PrimitiveMain<Instance[P]>;
71
- };
72
-
73
- type PrimitiveTuple<T extends readonly any[]> = T extends []
74
- ? []
75
- : T extends [infer F]
76
- ? [PrimitiveMain<F>]
77
- : T extends [infer F, ...infer Rest extends readonly any[]]
78
- ? [PrimitiveMain<F>, ...PrimitiveTuple<Rest>]
79
- : T extends [(infer F)?]
80
- ? [PrimitiveMain<F>?]
81
- : T extends [(infer F)?, ...infer Rest extends readonly any[]]
82
- ? [PrimitiveMain<F>?, ...PrimitiveTuple<Rest>]
83
- : [];
84
-
85
- type ValueOf<Instance> =
86
- IsValueOf<Instance, Boolean> extends true
87
- ? boolean
88
- : IsValueOf<Instance, Number> extends true
89
- ? number
90
- : IsValueOf<Instance, String> extends true
91
- ? string
92
- : Instance;
93
-
94
- type NativeClass =
95
- | Set<any>
96
- | Map<any, any>
97
- | WeakSet<any>
98
- | WeakMap<any, any>
99
- | Uint8Array
100
- | Uint8ClampedArray
101
- | Uint16Array
102
- | Uint32Array
103
- | BigUint64Array
104
- | Int8Array
105
- | Int16Array
106
- | Int32Array
107
- | BigInt64Array
108
- | Float32Array
109
- | Float64Array
110
- | ArrayBuffer
111
- | SharedArrayBuffer
112
- | DataView
113
- | Blob
114
- | File
115
- | RegExp;
116
-
117
- type IsTuple<T extends readonly any[] | { length: number }> = [T] extends [
118
- never,
119
- ]
120
- ? false
121
- : T extends readonly any[]
122
- ? number extends T["length"]
123
- ? false
124
- : true
125
- : false;
126
-
127
- type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object
128
- ? Object extends IValueOf<infer U>
129
- ? Instance extends U
130
- ? false
131
- : true // not Primitive, but Object
132
- : false // cannot be
133
- : false;
134
-
135
- interface IValueOf<T> {
136
- valueOf(): T;
137
- }
138
-
139
- interface IJsonable<T> {
140
- toJSON(): T;
141
- }
142
-
143
- type FormatDateTime = {
144
- "typia.tag"?: {
145
- target: "string";
146
- kind: "format";
147
- value: "date-time";
148
- validate: `/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T|\\s)([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i.test($input)`;
149
- exclusive: ["format", "pattern"];
150
- schema: {
151
- format: "date-time";
152
- };
153
- };
154
- };
package/src/Resolved.ts DELETED
@@ -1,120 +0,0 @@
1
- /**
2
- * Resolved type erased every methods.
3
- *
4
- * `Resolved` is a type of TMP (Type Meta Programming) type which converts
5
- * its argument as a resolved type that erased every method properties.
6
- *
7
- * If the target argument is a built-in class which returns its origin primitive type
8
- * through the `valueOf()` method like the `String` or `Number`, its return type would
9
- * be the `string` or `number`. Otherwise, the built-in class does not have the
10
- * `valueOf()` method, the return type would be same with the target argument.
11
- *
12
- * Otherwise, the target argument is a type of custom class, all of its custom methods
13
- * would be erased and its prototype would be changed to the primitive `object`.
14
- * Therefore, return type of the TMP type finally be the resolved object.
15
- *
16
- * Before | After
17
- * ------------------------|----------------------------------------
18
- * `Boolean` | `boolean`
19
- * `Number` | `number`
20
- * `BigInt` | `bigint`
21
- * `String` | `string`
22
- * `Class` | `interface`
23
- * Native Class or Others | No change
24
- *
25
- * @template T Target argument type.
26
- * @author Jeongho Nam - https://github.com/samchon
27
- * @author Kyungsu Kang - https://github.com/kakasoo
28
- */
29
- export type Resolved<T> =
30
- Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;
31
-
32
- type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
33
-
34
- type ResolvedMain<T> = T extends [never]
35
- ? never // (special trick for jsonable | null) type
36
- : ValueOf<T> extends boolean | number | bigint | string
37
- ? ValueOf<T>
38
- : T extends Function
39
- ? never
40
- : T extends object
41
- ? ResolvedObject<T>
42
- : ValueOf<T>;
43
-
44
- type ResolvedObject<T extends object> =
45
- T extends Array<infer U>
46
- ? IsTuple<T> extends true
47
- ? ResolvedTuple<T>
48
- : ResolvedMain<U>[]
49
- : T extends Set<infer U>
50
- ? Set<ResolvedMain<U>>
51
- : T extends Map<infer K, infer V>
52
- ? Map<ResolvedMain<K>, ResolvedMain<V>>
53
- : T extends WeakSet<any> | WeakMap<any, any>
54
- ? never
55
- : T extends
56
- | Date
57
- | Uint8Array
58
- | Uint8ClampedArray
59
- | Uint16Array
60
- | Uint32Array
61
- | BigUint64Array
62
- | Int8Array
63
- | Int16Array
64
- | Int32Array
65
- | BigInt64Array
66
- | Float32Array
67
- | Float64Array
68
- | ArrayBuffer
69
- | SharedArrayBuffer
70
- | DataView
71
- | Blob
72
- | File
73
- | RegExp
74
- ? T
75
- : {
76
- [P in keyof T]: ResolvedMain<T[P]>;
77
- };
78
-
79
- type ResolvedTuple<T extends readonly any[]> = T extends []
80
- ? []
81
- : T extends [infer F]
82
- ? [ResolvedMain<F>]
83
- : T extends [infer F, ...infer Rest extends readonly any[]]
84
- ? [ResolvedMain<F>, ...ResolvedTuple<Rest>]
85
- : T extends [(infer F)?]
86
- ? [ResolvedMain<F>?]
87
- : T extends [(infer F)?, ...infer Rest extends readonly any[]]
88
- ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>]
89
- : [];
90
-
91
- type IsTuple<T extends readonly any[] | { length: number }> = [T] extends [
92
- never,
93
- ]
94
- ? false
95
- : T extends readonly any[]
96
- ? number extends T["length"]
97
- ? false
98
- : true
99
- : false;
100
-
101
- type ValueOf<Instance> =
102
- IsValueOf<Instance, Boolean> extends true
103
- ? boolean
104
- : IsValueOf<Instance, Number> extends true
105
- ? number
106
- : IsValueOf<Instance, String> extends true
107
- ? string
108
- : Instance;
109
-
110
- type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object
111
- ? Object extends IValueOf<infer Primitive>
112
- ? Instance extends Primitive
113
- ? false
114
- : true // not Primitive, but Object
115
- : false // cannot be
116
- : false;
117
-
118
- interface IValueOf<T> {
119
- valueOf(): T;
120
- }