@nestia/fetcher 1.3.2 → 1.3.4

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,54 +1,46 @@
1
- import { IEncryptionPassword } from "./IEncryptionPassword";
2
- import { IRandomGenerator } from "./IRandomGenerator";
3
- /**
4
- * Connection information.
5
- *
6
- * `IConnection` is an interface ttype who represents connection information of the
7
- * remote HTTP server. You can target the remote HTTP server by wring the
8
- * {@link IConnection.host} variable down. Also, you can configure special header values
9
- * by specializing the {@link IConnection.headers} variable.
10
- *
11
- * If the remote HTTP server encrypts or decrypts its body data through the AES-128/256
12
- * algorithm, specify the {@link IConnection.encryption} with {@link IEncryptionPassword}
13
- * or {@link IEncryptionPassword.Closure} variable.
14
- *
15
- * @author Jenogho Nam - https://github.com/samchon
16
- */
17
- export interface IConnection {
18
- /**
19
- * Host address of the remote HTTP server.
20
- */
21
- host: string;
22
- /**
23
- * Header values delivered to the remote HTTP server.
24
- */
25
- headers?: Record<string, string>;
26
- /**
27
- * Encryption password of its closure function.
28
- */
29
- encryption?: IEncryptionPassword | IEncryptionPassword.Closure;
30
- /**
31
- * Use simulation mode.
32
- *
33
- * If you configure this property to be `true` or assign an {@link IRandomGenerator}
34
- * instance, your SDK library does not send any request to remote backend server,
35
- * but just returns random data generated by `typia.random<T>()` function with
36
- * request data validation.
37
- *
38
- * By the way, to utilize this simulation mode, SDK library must be generated with
39
- * {@link INestiaConfig.simulate} option, too. Open `nestia.config.ts` file, and
40
- * configure {@link INestiaConfig.simulate} property to be `true`. Them, newly
41
- * generated SDK library would have a built-in mock-up data generator.
42
- *
43
- * @default false
44
- */
45
- simulate?: boolean | Partial<IRandomGenerator>;
46
- /**
47
- * Use simulation mode.
48
- *
49
- * @default false
50
- * @deprecated Use {@link simulate} property instead.
51
- * This property would be erased after v2.0 update
52
- */
53
- random?: boolean | Partial<IRandomGenerator>;
54
- }
1
+ import { IEncryptionPassword } from "./IEncryptionPassword";
2
+ import { IRandomGenerator } from "./IRandomGenerator";
3
+ /**
4
+ * Connection information.
5
+ *
6
+ * `IConnection` is an interface ttype who represents connection information of the
7
+ * remote HTTP server. You can target the remote HTTP server by wring the
8
+ * {@link IConnection.host} variable down. Also, you can configure special header values
9
+ * by specializing the {@link IConnection.headers} variable.
10
+ *
11
+ * If the remote HTTP server encrypts or decrypts its body data through the AES-128/256
12
+ * algorithm, specify the {@link IConnection.encryption} with {@link IEncryptionPassword}
13
+ * or {@link IEncryptionPassword.Closure} variable.
14
+ *
15
+ * @author Jenogho Nam - https://github.com/samchon
16
+ */
17
+ export interface IConnection {
18
+ /**
19
+ * Host address of the remote HTTP server.
20
+ */
21
+ host: string;
22
+ /**
23
+ * Header values delivered to the remote HTTP server.
24
+ */
25
+ headers?: Record<string, string>;
26
+ /**
27
+ * Encryption password of its closure function.
28
+ */
29
+ encryption?: IEncryptionPassword | IEncryptionPassword.Closure;
30
+ /**
31
+ * Use simulation mode.
32
+ *
33
+ * If you configure this property to be `true` or assign an {@link IRandomGenerator}
34
+ * instance, your SDK library does not send any request to remote backend server,
35
+ * but just returns random data generated by `typia.random<T>()` function with
36
+ * request data validation.
37
+ *
38
+ * By the way, to utilize this simulation mode, SDK library must be generated with
39
+ * {@link INestiaConfig.simulate} option, too. Open `nestia.config.ts` file, and
40
+ * configure {@link INestiaConfig.simulate} property to be `true`. Them, newly
41
+ * generated SDK library would have a built-in mock-up data generator.
42
+ *
43
+ * @default false
44
+ */
45
+ simulate?: boolean | Partial<IRandomGenerator>;
46
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=IConnection.js.map
@@ -1,46 +1,46 @@
1
- /**
2
- * Encryption password.
3
- *
4
- * `IEncryptionPassword` is a type of interface who represents encryption password used by
5
- * the {@link Fetcher} with AES-128/256 algorithm. If your encryption password is not fixed
6
- * but changes according to the input content, you can utilize the
7
- * {@link IEncryptionPassword.Closure} function type.
8
- *
9
- * @author Jeongho Nam - https://github.com/samchon
10
- */
11
- export interface IEncryptionPassword {
12
- /**
13
- * Secret key.
14
- */
15
- key: string;
16
- /**
17
- * Initialization vector.
18
- */
19
- iv: string;
20
- }
21
- export declare namespace IEncryptionPassword {
22
- /**
23
- * Type of a closure function returning the {@link IEncryptionPassword} object.
24
- *
25
- * `IEncryptionPassword.Closure` is a type of closure function who are returning the
26
- * {@link IEncryptionPassword} object. It would be used when your encryption password
27
- * be changed according to the input content.
28
- */
29
- interface Closure {
30
- /**
31
- * Encryption password getter.
32
- *
33
- * @param param Request or response headers and body content
34
- * @param encoded Be encoded or to be decoded
35
- * @returns Encryption password
36
- */
37
- (param: IParameter, encoded: boolean): IEncryptionPassword;
38
- }
39
- /**
40
- * Parameter for the closure.
41
- */
42
- interface IParameter {
43
- headers: Record<string, string>;
44
- body: string;
45
- }
46
- }
1
+ /**
2
+ * Encryption password.
3
+ *
4
+ * `IEncryptionPassword` is a type of interface who represents encryption password used by
5
+ * the {@link Fetcher} with AES-128/256 algorithm. If your encryption password is not fixed
6
+ * but changes according to the input content, you can utilize the
7
+ * {@link IEncryptionPassword.Closure} function type.
8
+ *
9
+ * @author Jeongho Nam - https://github.com/samchon
10
+ */
11
+ export interface IEncryptionPassword {
12
+ /**
13
+ * Secret key.
14
+ */
15
+ key: string;
16
+ /**
17
+ * Initialization vector.
18
+ */
19
+ iv: string;
20
+ }
21
+ export declare namespace IEncryptionPassword {
22
+ /**
23
+ * Type of a closure function returning the {@link IEncryptionPassword} object.
24
+ *
25
+ * `IEncryptionPassword.Closure` is a type of closure function who are returning the
26
+ * {@link IEncryptionPassword} object. It would be used when your encryption password
27
+ * be changed according to the input content.
28
+ */
29
+ interface Closure {
30
+ /**
31
+ * Encryption password getter.
32
+ *
33
+ * @param param Request or response headers and body content
34
+ * @param encoded Be encoded or to be decoded
35
+ * @returns Encryption password
36
+ */
37
+ (param: IParameter, encoded: boolean): IEncryptionPassword;
38
+ }
39
+ /**
40
+ * Parameter for the closure.
41
+ */
42
+ interface IParameter {
43
+ headers: Record<string, string>;
44
+ body: string;
45
+ }
46
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=IEncryptionPassword.js.map
@@ -1,32 +1,32 @@
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
+ 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 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=IRandomGenerator.js.map
@@ -1,52 +1,54 @@
1
- /**
2
- * Primitive type.
3
- *
4
- * `Primitive` is a type of TMP (Type Meta Programming) type who converts its argument as a
5
- * primitive type.
6
- *
7
- * If the target argument is a built-in class who returns its origin primitive type through
8
- * the `valueOf()` method like the `String` or `Number`, its return type would be the
9
- * `string` or `number`.
10
- *
11
- * Otherwise, the target argument is a type of custom class, all of its custom method would
12
- * be erased and its prototype would be changed to the primitive `object`. Therefore, return
13
- * type of the TMP type finally be the primitive object.
14
- *
15
- * In addition, if the target argument is a type of custom class and it has a special
16
- * method `toJSON()`, return type of this `Primitive` would be not `Primitive<Instance>`
17
- * but `Primitive<ReturnType<Instance.toJSON>>`.
18
- *
19
- * Before | After
20
- * ------------------------|----------------------------------------
21
- * `Boolean` | `boolean`
22
- * `Number` | `number`
23
- * `String` | `string`
24
- * `Class` | `object`
25
- * `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
26
- * Others | No change
27
- *
28
- * @template Instance Target argument type.
29
- * @author Jenogho Nam - https://github.com/samchon
30
- */
31
- export type Primitive<T> = Equal<T, PrimitiveMain<T>> extends true ? T : PrimitiveMain<T>;
32
- type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
33
- type PrimitiveMain<Instance> = ValueOf<Instance> extends object ? Instance extends object ? Instance extends NativeClass ? {} : Instance extends IJsonable<infer Raw> ? ValueOf<Raw> extends object ? Raw extends object ? PrimitiveObject<Raw> : never : ValueOf<Raw> : PrimitiveObject<Instance> : never : ValueOf<Instance>;
34
- type PrimitiveObject<Instance extends object> = Instance extends Array<infer T> ? IsTuple<Instance> extends true ? PrimitiveTuple<Instance> : PrimitiveMain<T>[] : {
35
- [P in keyof Instance]: Instance[P] extends Function ? never : PrimitiveMain<Instance[P]>;
36
- };
37
- 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>] : [];
38
- type ValueOf<Instance> = IsValueOf<Instance, Boolean> extends true ? boolean : IsValueOf<Instance, Number> extends true ? number : IsValueOf<Instance, String> extends true ? string : Instance;
39
- 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;
40
- type IsTuple<T extends readonly any[] | {
41
- length: number;
42
- }> = [T] extends [
43
- never
44
- ] ? false : T extends readonly any[] ? number extends T["length"] ? false : true : false;
45
- type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object ? Object extends IValueOf<infer Primitive> ? Instance extends Primitive ? false : true : false : false;
46
- interface IValueOf<T> {
47
- valueOf(): T;
48
- }
49
- interface IJsonable<T> {
50
- toJSON(): T;
51
- }
52
- export {};
1
+ /**
2
+ * Primitive type.
3
+ *
4
+ * `Primitive` is a type of TMP (Type Meta Programming) type who converts its argument as a
5
+ * primitive type.
6
+ *
7
+ * If the target argument is a built-in class who returns its origin primitive type through
8
+ * the `valueOf()` method like the `String` or `Number`, its return type would be the
9
+ * `string` or `number`.
10
+ *
11
+ * Otherwise, the target argument is a type of custom class, all of its custom method would
12
+ * be erased and its prototype would be changed to the primitive `object`. Therefore, return
13
+ * type of the TMP type finally be the primitive object.
14
+ *
15
+ * In addition, if the target argument is a type of custom class and it has a special
16
+ * method `toJSON()`, return type of this `Primitive` would be not `Primitive<Instance>`
17
+ * but `Primitive<ReturnType<Instance.toJSON>>`.
18
+ *
19
+ * Before | After
20
+ * ------------------------|----------------------------------------
21
+ * `Boolean` | `boolean`
22
+ * `Number` | `number`
23
+ * `String` | `string`
24
+ * `Class` | `object`
25
+ * `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
26
+ * Others | No change
27
+ *
28
+ * @template Instance Target argument type.
29
+ * @author Jenogho Nam - https://github.com/samchon
30
+ * @author Kyungsu Kang - https://github.com/kakasoo
31
+ * @author Michael - https://github.com/8471919
32
+ */
33
+ export type Primitive<T> = Equal<T, PrimitiveMain<T>> extends true ? T : PrimitiveMain<T>;
34
+ type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
35
+ type PrimitiveMain<Instance> = Instance extends [never] ? never : ValueOf<Instance> extends boolean | number | bigint | string ? ValueOf<Instance> : ValueOf<Instance> extends object ? Instance extends object ? Instance extends NativeClass ? {} : Instance extends IJsonable<infer Raw> ? ValueOf<Raw> extends object ? Raw extends object ? PrimitiveObject<Raw> : never : ValueOf<Raw> : PrimitiveObject<Instance> : never : ValueOf<Instance>;
36
+ type PrimitiveObject<Instance extends object> = Instance extends Array<infer T> ? IsTuple<Instance> extends true ? PrimitiveTuple<Instance> : PrimitiveMain<T>[] : {
37
+ [P in keyof Instance]: Instance[P] extends Function ? never : PrimitiveMain<Instance[P]>;
38
+ };
39
+ 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>] : [];
40
+ type ValueOf<Instance> = IsValueOf<Instance, Boolean> extends true ? boolean : IsValueOf<Instance, Number> extends true ? number : IsValueOf<Instance, String> extends true ? string : Instance;
41
+ 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;
42
+ type IsTuple<T extends readonly any[] | {
43
+ length: number;
44
+ }> = [T] extends [
45
+ never
46
+ ] ? false : T extends readonly any[] ? number extends T["length"] ? false : true : false;
47
+ type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object ? Object extends IValueOf<infer Primitive> ? Instance extends Primitive ? false : true : false : false;
48
+ interface IValueOf<T> {
49
+ valueOf(): T;
50
+ }
51
+ interface IJsonable<T> {
52
+ toJSON(): T;
53
+ }
54
+ export {};
package/lib/Primitive.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=Primitive.js.map
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from "./IConnection";
2
- export * from "./IEncryptionPassword";
3
- export * from "./Primitive";
4
- export * from "./AesPkcs5";
5
- export * from "./Fetcher";
6
- export * from "./HttpError";
1
+ export * from "./IConnection";
2
+ export * from "./IEncryptionPassword";
3
+ export * from "./Primitive";
4
+ export * from "./AesPkcs5";
5
+ export * from "./Fetcher";
6
+ export * from "./HttpError";
package/lib/index.js CHANGED
@@ -1,23 +1,23 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./IConnection"), exports);
18
- __exportStar(require("./IEncryptionPassword"), exports);
19
- __exportStar(require("./Primitive"), exports);
20
- __exportStar(require("./AesPkcs5"), exports);
21
- __exportStar(require("./Fetcher"), exports);
22
- __exportStar(require("./HttpError"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./IConnection"), exports);
18
+ __exportStar(require("./IEncryptionPassword"), exports);
19
+ __exportStar(require("./Primitive"), exports);
20
+ __exportStar(require("./AesPkcs5"), exports);
21
+ __exportStar(require("./Fetcher"), exports);
22
+ __exportStar(require("./HttpError"), exports);
23
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,24 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Singleton = void 0;
4
- /**
5
- * @internal
6
- */
7
- var Singleton = /** @class */ (function () {
8
- function Singleton(closure_) {
9
- this.closure_ = closure_;
10
- this.value_ = NOT_MOUNTED_YET;
11
- }
12
- Singleton.prototype.get = function () {
13
- if (this.value_ === NOT_MOUNTED_YET)
14
- this.value_ = this.closure_();
15
- return this.value_;
16
- };
17
- return Singleton;
18
- }());
19
- exports.Singleton = Singleton;
20
- /**
21
- * @internal
22
- */
23
- var NOT_MOUNTED_YET = {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Singleton = void 0;
4
+ /**
5
+ * @internal
6
+ */
7
+ var Singleton = /** @class */ (function () {
8
+ function Singleton(closure_) {
9
+ this.closure_ = closure_;
10
+ this.value_ = NOT_MOUNTED_YET;
11
+ }
12
+ Singleton.prototype.get = function () {
13
+ if (this.value_ === NOT_MOUNTED_YET)
14
+ this.value_ = this.closure_();
15
+ return this.value_;
16
+ };
17
+ return Singleton;
18
+ }());
19
+ exports.Singleton = Singleton;
20
+ /**
21
+ * @internal
22
+ */
23
+ var NOT_MOUNTED_YET = {};
24
24
  //# sourceMappingURL=Singleton.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/fetcher",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Fetcher library of Nestia SDK",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -32,7 +32,10 @@
32
32
  "@typescript-eslint/parser": "^5.46.1",
33
33
  "prettier": "^2.8.1",
34
34
  "rimraf": "^3.0.2",
35
- "typescript": "^4.9.4"
35
+ "typescript": "^5.1.3"
36
+ },
37
+ "peerDependencies": {
38
+ "typescript": ">= 4.7.4"
36
39
  },
37
40
  "dependencies": {
38
41
  "import2": "^1.0.3",
@@ -47,13 +47,4 @@ export interface IConnection {
47
47
  * @default false
48
48
  */
49
49
  simulate?: boolean | Partial<IRandomGenerator>;
50
-
51
- /**
52
- * Use simulation mode.
53
- *
54
- * @default false
55
- * @deprecated Use {@link simulate} property instead.
56
- * This property would be erased after v2.0 update
57
- */
58
- random?: boolean | Partial<IRandomGenerator>;
59
50
  }
package/src/Primitive.ts CHANGED
@@ -27,6 +27,8 @@
27
27
  *
28
28
  * @template Instance Target argument type.
29
29
  * @author Jenogho Nam - https://github.com/samchon
30
+ * @author Kyungsu Kang - https://github.com/kakasoo
31
+ * @author Michael - https://github.com/8471919
30
32
  */
31
33
  export type Primitive<T> = Equal<T, PrimitiveMain<T>> extends true
32
34
  ? T
@@ -34,7 +36,11 @@ export type Primitive<T> = Equal<T, PrimitiveMain<T>> extends true
34
36
 
35
37
  type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
36
38
 
37
- type PrimitiveMain<Instance> = ValueOf<Instance> extends object
39
+ type PrimitiveMain<Instance> = Instance extends [never]
40
+ ? never // (special trick for jsonable | null) type
41
+ : ValueOf<Instance> extends boolean | number | bigint | string
42
+ ? ValueOf<Instance>
43
+ : ValueOf<Instance> extends object
38
44
  ? Instance extends object
39
45
  ? Instance extends NativeClass
40
46
  ? {}