@stryke/types 0.10.13 → 0.10.19
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/README.md +18 -10
- package/dist/{array.d.ts → array-DVtfX_TI.d.mts} +17 -13
- package/dist/array-DVtfX_TI.d.mts.map +1 -0
- package/dist/array-DtIKbcDr.d.cts +122 -0
- package/dist/array-DtIKbcDr.d.cts.map +1 -0
- package/dist/array.cjs +0 -1
- package/dist/array.d.cts +2 -0
- package/dist/array.d.mts +2 -0
- package/dist/array.mjs +1 -0
- package/dist/{async.d.ts → async-BtPWg6IL.d.mts} +14 -8
- package/dist/async-BtPWg6IL.d.mts.map +1 -0
- package/dist/async-eKWh-_sF.d.cts +111 -0
- package/dist/async-eKWh-_sF.d.cts.map +1 -0
- package/dist/async.cjs +0 -1
- package/dist/async.d.cts +2 -0
- package/dist/async.d.mts +2 -0
- package/dist/async.mjs +1 -0
- package/dist/{base.d.ts → base-CiIyKS-b.d.mts} +120 -126
- package/dist/base-CiIyKS-b.d.mts.map +1 -0
- package/dist/base-Cpeh4C5c.cjs +3 -0
- package/dist/base-DmFPRVSE.mjs +3 -0
- package/dist/base-DmFPRVSE.mjs.map +1 -0
- package/dist/base-EF17pdAI.d.cts +331 -0
- package/dist/base-EF17pdAI.d.cts.map +1 -0
- package/dist/base.cjs +1 -16
- package/dist/base.d.cts +2 -0
- package/dist/base.d.mts +2 -0
- package/dist/base.mjs +1 -2
- package/dist/configuration-5Q2wg3Id.d.mts +71 -0
- package/dist/configuration-5Q2wg3Id.d.mts.map +1 -0
- package/dist/configuration-Dvz7q6dd.d.cts +71 -0
- package/dist/configuration-Dvz7q6dd.d.cts.map +1 -0
- package/dist/configuration.cjs +0 -1
- package/dist/configuration.d.cts +2 -0
- package/dist/configuration.d.mts +2 -0
- package/dist/configuration.mjs +1 -0
- package/dist/file-dM8RAMNC.d.cts +51 -0
- package/dist/file-dM8RAMNC.d.cts.map +1 -0
- package/dist/file-eWushyiM.d.mts +51 -0
- package/dist/file-eWushyiM.d.mts.map +1 -0
- package/dist/file.cjs +0 -1
- package/dist/file.d.cts +2 -0
- package/dist/file.d.mts +2 -0
- package/dist/file.mjs +1 -0
- package/dist/form-mTzpZCeA.d.cts +40 -0
- package/dist/form-mTzpZCeA.d.cts.map +1 -0
- package/dist/form-sNCVXIEk.d.mts +40 -0
- package/dist/form-sNCVXIEk.d.mts.map +1 -0
- package/dist/form.cjs +0 -1
- package/dist/form.d.cts +2 -0
- package/dist/form.d.mts +2 -0
- package/dist/form.mjs +1 -0
- package/dist/index.cjs +1 -214
- package/dist/index.d.cts +19 -0
- package/dist/index.d.mts +19 -0
- package/dist/index.mjs +1 -1
- package/dist/{json.d.ts → json-BlaU0Pbq.d.cts} +11 -13
- package/dist/json-BlaU0Pbq.d.cts.map +1 -0
- package/dist/json-C3wqh2t3.d.mts +70 -0
- package/dist/json-C3wqh2t3.d.mts.map +1 -0
- package/dist/json.cjs +0 -1
- package/dist/json.d.cts +2 -0
- package/dist/json.d.mts +2 -0
- package/dist/json.mjs +1 -0
- package/dist/logic-BoEG5A3-.d.cts +374 -0
- package/dist/logic-BoEG5A3-.d.cts.map +1 -0
- package/dist/logic-h9Jrrpsk.d.mts +374 -0
- package/dist/logic-h9Jrrpsk.d.mts.map +1 -0
- package/dist/logic.cjs +0 -1
- package/dist/logic.d.cts +2 -0
- package/dist/logic.d.mts +2 -0
- package/dist/logic.mjs +1 -0
- package/dist/messages-Bxu_o13x.d.mts +21 -0
- package/dist/messages-Bxu_o13x.d.mts.map +1 -0
- package/dist/messages-PtLJRJeN.d.cts +21 -0
- package/dist/messages-PtLJRJeN.d.cts.map +1 -0
- package/dist/messages.cjs +0 -1
- package/dist/messages.d.cts +2 -0
- package/dist/messages.d.mts +2 -0
- package/dist/messages.mjs +1 -0
- package/dist/navigator-DLpMW73v.d.mts +42 -0
- package/dist/navigator-DLpMW73v.d.mts.map +1 -0
- package/dist/navigator-wsxMUGqK.d.cts +42 -0
- package/dist/navigator-wsxMUGqK.d.cts.map +1 -0
- package/dist/navigator.cjs +0 -1
- package/dist/navigator.d.cts +2 -0
- package/dist/navigator.d.mts +2 -0
- package/dist/navigator.mjs +1 -0
- package/dist/number.cjs +0 -1
- package/dist/number.d.cts +2 -0
- package/dist/number.d.mts +2 -0
- package/dist/number.mjs +1 -0
- package/dist/{object.d.ts → object-B3Rc0f80.d.mts} +56 -84
- package/dist/object-B3Rc0f80.d.mts.map +1 -0
- package/dist/object-DyLgFijN.d.cts +392 -0
- package/dist/object-DyLgFijN.d.cts.map +1 -0
- package/dist/object.cjs +0 -1
- package/dist/object.d.cts +2 -0
- package/dist/object.d.mts +2 -0
- package/dist/object.mjs +1 -0
- package/dist/package-json-BYMmXu4B.d.mts +261 -0
- package/dist/package-json-BYMmXu4B.d.mts.map +1 -0
- package/dist/package-json-DMeUqEmW.d.cts +261 -0
- package/dist/package-json-DMeUqEmW.d.cts.map +1 -0
- package/dist/package-json.cjs +0 -1
- package/dist/package-json.d.cts +2 -0
- package/dist/package-json.d.mts +2 -0
- package/dist/package-json.mjs +1 -0
- package/dist/package-manager-PRcovqs-.d.mts +6 -0
- package/dist/package-manager-PRcovqs-.d.mts.map +1 -0
- package/dist/package-manager-tcG2TLVT.d.cts +6 -0
- package/dist/package-manager-tcG2TLVT.d.cts.map +1 -0
- package/dist/package-manager.cjs +0 -1
- package/dist/package-manager.d.cts +2 -0
- package/dist/package-manager.d.mts +2 -0
- package/dist/package-manager.mjs +1 -0
- package/dist/string.cjs +0 -1
- package/dist/string.d.cts +2 -0
- package/dist/string.d.mts +2 -0
- package/dist/string.mjs +1 -0
- package/dist/system-BxYi2_rE.d.mts +5 -0
- package/dist/system-BxYi2_rE.d.mts.map +1 -0
- package/dist/system-n1LPjzuJ.d.cts +5 -0
- package/dist/system-n1LPjzuJ.d.cts.map +1 -0
- package/dist/system.cjs +0 -1
- package/dist/system.d.cts +2 -0
- package/dist/system.d.mts +2 -0
- package/dist/system.mjs +1 -0
- package/dist/tsconfig-C6dWY2RO.d.cts +803 -0
- package/dist/tsconfig-C6dWY2RO.d.cts.map +1 -0
- package/dist/tsconfig-CUKA7cEN.d.mts +803 -0
- package/dist/tsconfig-CUKA7cEN.d.mts.map +1 -0
- package/dist/tsconfig.cjs +0 -1
- package/dist/tsconfig.d.cts +2 -0
- package/dist/tsconfig.d.mts +2 -0
- package/dist/tsconfig.mjs +1 -0
- package/dist/user-CkdO4wnf.d.mts +29 -0
- package/dist/user-CkdO4wnf.d.mts.map +1 -0
- package/dist/user-CovHR6Ne.d.cts +29 -0
- package/dist/user-CovHR6Ne.d.cts.map +1 -0
- package/dist/user.cjs +0 -1
- package/dist/user.d.cts +2 -0
- package/dist/user.d.mts +2 -0
- package/dist/user.mjs +1 -0
- package/dist/utilities-BVS-gcgS.d.mts +51 -0
- package/dist/utilities-BVS-gcgS.d.mts.map +1 -0
- package/dist/utilities-Jb4ggdM-.d.cts +51 -0
- package/dist/utilities-Jb4ggdM-.d.cts.map +1 -0
- package/dist/utilities.cjs +0 -1
- package/dist/utilities.d.cts +2 -0
- package/dist/utilities.d.mts +2 -0
- package/dist/utilities.mjs +1 -0
- package/dist/validations-C_7osVpS.d.mts +21 -0
- package/dist/validations-C_7osVpS.d.mts.map +1 -0
- package/dist/validations-CvwxY4RE.d.cts +21 -0
- package/dist/validations-CvwxY4RE.d.cts.map +1 -0
- package/dist/validations.cjs +0 -1
- package/dist/validations.d.cts +2 -0
- package/dist/validations.d.mts +2 -0
- package/dist/validations.mjs +1 -0
- package/package.json +68 -247
- package/dist/configuration.d.ts +0 -67
- package/dist/file.d.ts +0 -46
- package/dist/form.d.ts +0 -35
- package/dist/index.d.ts +0 -27
- package/dist/logic.d.ts +0 -152
- package/dist/messages.d.ts +0 -17
- package/dist/navigator.d.ts +0 -41
- package/dist/number.d.ts +0 -176
- package/dist/package-json.d.ts +0 -260
- package/dist/package-manager.d.ts +0 -2
- package/dist/string.d.ts +0 -75
- package/dist/system.d.ts +0 -1
- package/dist/tsconfig.d.ts +0 -798
- package/dist/user.d.ts +0 -25
- package/dist/utilities.d.ts +0 -53
- package/dist/validations.d.ts +0 -16
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { l as TypedArray } from "./array-DVtfX_TI.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/base.d.ts
|
|
4
|
+
type SerializablePrimitive = null | undefined | string | number | boolean | bigint;
|
|
5
|
+
type Primitive = SerializablePrimitive | symbol;
|
|
4
6
|
/**
|
|
5
7
|
* Matches any primitive, `void`, `Date`, or `RegExp` value.
|
|
6
8
|
*/
|
|
7
|
-
|
|
9
|
+
type BuiltIns = Primitive | void | Date | RegExp;
|
|
8
10
|
/**
|
|
9
11
|
* Matches any non-primitive object
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
type AtomicObject = Function | Promise<any> | Date | RegExp;
|
|
12
14
|
/** Determines if the passed value is of a specific type */
|
|
13
|
-
|
|
15
|
+
type TypeTester = (value: any) => boolean;
|
|
14
16
|
/**
|
|
15
17
|
* The interface for a type mapping (key =\> function) to use for {@link getType}.
|
|
16
18
|
* export * The key represents the name of the type. The function represents the {@link TypeTester | test method}.
|
|
17
19
|
* The map should be ordered by testing preference, with more specific tests first.
|
|
18
20
|
* If a test returns true, it is selected, and the key is returned as the type.
|
|
19
21
|
*/
|
|
20
|
-
|
|
22
|
+
type TypeMap = Record<string, TypeTester>;
|
|
21
23
|
declare const emptyObjectSymbol: unique symbol;
|
|
22
|
-
|
|
24
|
+
type FunctionOrValue<Value> = Value extends (() => infer X) ? X : Value;
|
|
23
25
|
/**
|
|
24
26
|
* A [[List]]
|
|
25
27
|
*
|
|
@@ -32,7 +34,7 @@ export type FunctionOrValue<Value> = Value extends () => infer X ? X : Value;
|
|
|
32
34
|
* @param A - its type
|
|
33
35
|
* @returns [[List]]
|
|
34
36
|
*/
|
|
35
|
-
|
|
37
|
+
type List<A = any> = ReadonlyArray<A>;
|
|
36
38
|
/**
|
|
37
39
|
* Alias to create a [[Function]]
|
|
38
40
|
*
|
|
@@ -48,28 +50,28 @@ export type List<A = any> = ReadonlyArray<A>;
|
|
|
48
50
|
* @param R - return type
|
|
49
51
|
* @returns [[Function]]
|
|
50
52
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
type FunctionLike<P extends List = any, R$1 = any> = (...args: P) => R$1;
|
|
54
|
+
type AnyFunction = FunctionLike<any, any>;
|
|
55
|
+
type Nullish = undefined | null;
|
|
56
|
+
type Nullishable<T> = T | Nullish;
|
|
57
|
+
type NonNullishObject = object;
|
|
58
|
+
type NativeClass = abstract new (...args: any) => any;
|
|
59
|
+
type AnyNumber = number | number;
|
|
60
|
+
type AnyString = string | string;
|
|
61
|
+
type AnyBoolean = boolean | boolean;
|
|
62
|
+
type AnyArray = any[];
|
|
63
|
+
type PlainObject = Record<any, object>;
|
|
64
|
+
type AnyMap = Map<any, any>;
|
|
65
|
+
type AnyWeakMap = WeakMap<WeakKey, any>;
|
|
66
|
+
type EmptyArray = [];
|
|
67
|
+
interface EmptyObject {
|
|
68
|
+
[emptyObjectSymbol]?: never;
|
|
67
69
|
}
|
|
68
|
-
|
|
70
|
+
type Any = boolean | number | bigint | string | null | undefined | void | symbol | object | PlainObject | AnyArray | AnyMap | AnyWeakMap;
|
|
69
71
|
/**
|
|
70
72
|
* The valid types of the index for an `Indexable` type object
|
|
71
73
|
*/
|
|
72
|
-
|
|
74
|
+
type IndexType = string | number | symbol;
|
|
73
75
|
/**
|
|
74
76
|
* The declaration of a ***dictionary-type*** object with a specific type
|
|
75
77
|
*
|
|
@@ -77,7 +79,7 @@ export type IndexType = string | number | symbol;
|
|
|
77
79
|
* @see {@link IndexType}
|
|
78
80
|
* @see {@link Dictionary}
|
|
79
81
|
*/
|
|
80
|
-
|
|
82
|
+
type TypedIndexable<T> = Record<IndexType, T>;
|
|
81
83
|
/**
|
|
82
84
|
* The declaration of a ***dictionary-type*** object
|
|
83
85
|
*
|
|
@@ -85,7 +87,7 @@ export type TypedIndexable<T> = Record<IndexType, T>;
|
|
|
85
87
|
* @see {@link IndexType}
|
|
86
88
|
* @see {@link Dictionary}
|
|
87
89
|
*/
|
|
88
|
-
|
|
90
|
+
type Indexable = TypedIndexable<any>;
|
|
89
91
|
/**
|
|
90
92
|
* The declaration of a ***dictionary-type*** object with a specific type
|
|
91
93
|
*
|
|
@@ -93,41 +95,37 @@ export type Indexable = TypedIndexable<any>;
|
|
|
93
95
|
* @see {@link IndexType}
|
|
94
96
|
* @see {@link TypedIndexable}
|
|
95
97
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
type Dictionary<T> = Record<string, T>;
|
|
99
|
+
declare const EMPTY_STRING = "";
|
|
100
|
+
declare const NEWLINE_STRING = "\r\n";
|
|
101
|
+
declare const EMPTY_OBJECT: {};
|
|
102
|
+
type AnyCase<T extends IndexType> = string extends T ? string : T extends `${infer F1}${infer F2}${infer R}` ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${AnyCase<R>}` : T extends `${infer F}${infer R}` ? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}` : typeof EMPTY_STRING;
|
|
103
|
+
type Newable<T> = new (..._args: never[]) => T;
|
|
104
|
+
interface Abstract<T> {
|
|
105
|
+
prototype: T;
|
|
104
106
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
interface Clonable<T> {
|
|
108
|
+
clone: () => T;
|
|
107
109
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
};
|
|
121
|
-
export type Rollback = Record<string, (initialValue: any, currentValue: any) => any>;
|
|
110
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
111
|
+
type ReducerFunction<TState, TAction> = (state: TState, action: TAction) => TState;
|
|
112
|
+
declare const TYPE_ARGUMENTS = "Arguments";
|
|
113
|
+
declare const TYPE_ARRAY = "Array";
|
|
114
|
+
declare const TYPE_OBJECT = "Object";
|
|
115
|
+
declare const TYPE_MAP = "Map";
|
|
116
|
+
declare const TYPE_SET = "Set";
|
|
117
|
+
type Collection = IArguments | unknown[] | Map<unknown, unknown> | Record<string | number | symbol, unknown> | Set<unknown>;
|
|
118
|
+
type NonUndefined<T> = T extends undefined ? never : T;
|
|
119
|
+
type BrowserNativeObject = Date | File;
|
|
120
|
+
type DeepPartial<T> = T extends BrowserNativeObject | NestedValue ? T : { [K in keyof T]?: DeepPartial<T[K]> };
|
|
121
|
+
type Rollback = Record<string, (initialValue: any, currentValue: any) => any>;
|
|
122
122
|
/**
|
|
123
123
|
* Extract all required keys from the given type.
|
|
124
124
|
*
|
|
125
125
|
* @remarks
|
|
126
126
|
* This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
|
|
127
127
|
*/
|
|
128
|
-
|
|
129
|
-
[Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never;
|
|
130
|
-
}[keyof BaseType], undefined>;
|
|
128
|
+
type RequiredKeysOf<BaseType extends object> = Exclude<{ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never }[keyof BaseType], undefined>;
|
|
131
129
|
/**
|
|
132
130
|
* Returns a boolean for whether the two given types are equal.
|
|
133
131
|
*
|
|
@@ -137,17 +135,15 @@ export type RequiredKeysOf<BaseType extends object> = Exclude<{
|
|
|
137
135
|
* @see https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
138
136
|
* @see https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
139
137
|
*/
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
type IsEqual<A, B> = (<G>() => G extends A ? 1 : 2) extends (<G>() => G extends B ? 1 : 2) ? true : false;
|
|
139
|
+
type Filter<KeyType$1, ExcludeType> = IsEqual<KeyType$1, ExcludeType> extends true ? never : KeyType$1 extends ExcludeType ? never : KeyType$1;
|
|
142
140
|
interface ExceptOptions {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
*/
|
|
150
|
-
requireExactProps?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
Disallow assigning non-specified properties.
|
|
143
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
144
|
+
@defaultValue false
|
|
145
|
+
*/
|
|
146
|
+
requireExactProps?: boolean;
|
|
151
147
|
}
|
|
152
148
|
/**
|
|
153
149
|
* Create a type from an object type without certain keys.
|
|
@@ -159,11 +155,9 @@ interface ExceptOptions {
|
|
|
159
155
|
*
|
|
160
156
|
* This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
161
157
|
*/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}> = {
|
|
165
|
-
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
166
|
-
} & (Options["requireExactProps"] extends true ? Partial<Record<KeysType, never>> : Record<string, never>);
|
|
158
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {
|
|
159
|
+
requireExactProps: false;
|
|
160
|
+
}> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options["requireExactProps"] extends true ? Partial<Record<KeysType, never>> : Record<string, never>);
|
|
167
161
|
/**
|
|
168
162
|
* Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
169
163
|
*
|
|
@@ -174,61 +168,59 @@ export type Except<ObjectType, KeysType extends keyof ObjectType, Options extend
|
|
|
174
168
|
*
|
|
175
169
|
* @see https://github.com/microsoft/TypeScript/issues/15300
|
|
176
170
|
*/
|
|
177
|
-
|
|
178
|
-
[KeyType in keyof T]: T[KeyType];
|
|
179
|
-
} & {};
|
|
171
|
+
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
180
172
|
/**
|
|
181
173
|
* Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.
|
|
182
174
|
*
|
|
183
175
|
* @remarks
|
|
184
176
|
* Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
|
|
185
177
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
178
|
+
type SetRequired<BaseType, Keys extends keyof BaseType> = BaseType extends unknown ? Simplify<Except<BaseType, Keys> & Required<Pick<BaseType, Keys>>> : never;
|
|
179
|
+
declare const $NestedValue: unique symbol;
|
|
180
|
+
type NestedValue<TValue extends object = object> = {
|
|
181
|
+
[$NestedValue]: never;
|
|
190
182
|
} & TValue;
|
|
191
|
-
|
|
192
|
-
|
|
183
|
+
interface RefObject<T> {
|
|
184
|
+
current: T;
|
|
193
185
|
}
|
|
194
|
-
|
|
195
|
-
|
|
186
|
+
interface Identity<T = string> {
|
|
187
|
+
id: T;
|
|
196
188
|
}
|
|
197
|
-
|
|
198
|
-
|
|
189
|
+
interface Versioned {
|
|
190
|
+
version: number;
|
|
199
191
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
192
|
+
interface Sequenced {
|
|
193
|
+
/**
|
|
194
|
+
* The sequence number (version, or event counter, etc.) of the record
|
|
195
|
+
*/
|
|
196
|
+
sequence: number;
|
|
205
197
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
198
|
+
interface Typed {
|
|
199
|
+
/**
|
|
200
|
+
* The type of the record
|
|
201
|
+
*/
|
|
202
|
+
__type: string;
|
|
211
203
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
204
|
+
interface ClassTypeCheckable<T> extends Typed {
|
|
205
|
+
/**
|
|
206
|
+
* Run type check on the given value
|
|
207
|
+
* @param value - The value to check
|
|
208
|
+
* @returns True if the value is of the type of the class
|
|
209
|
+
*/
|
|
210
|
+
isTypeOf: (value: unknown) => value is T;
|
|
219
211
|
}
|
|
220
212
|
/**
|
|
221
213
|
* Matches non-recursive types.
|
|
222
214
|
*/
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
215
|
+
type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown);
|
|
216
|
+
type IsPrimitive<T> = [T] extends [Primitive] ? true : false;
|
|
217
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
218
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
219
|
+
type IsNull<T> = [T] extends [null] ? true : false;
|
|
220
|
+
type IsUndefined<T> = T extends undefined ? true : false;
|
|
221
|
+
type IsUnknown<T> = unknown extends T ? IsNull<T> extends false ? true : false : false;
|
|
222
|
+
type IsNullish<T> = IsNull<T> & IsUndefined<T>;
|
|
223
|
+
type IsFunction<T> = T extends AnyFunction ? true : false;
|
|
232
224
|
/**
|
|
233
225
|
* Declare locally scoped properties on `globalThis`.
|
|
234
226
|
*
|
|
@@ -247,31 +239,31 @@ export type IsFunction<T> = T extends AnyFunction ? true : false;
|
|
|
247
239
|
* (globalThis as ExtraGlobals).GLOBAL_TOKEN;
|
|
248
240
|
* ```
|
|
249
241
|
*/
|
|
250
|
-
|
|
242
|
+
type GlobalThis = typeof globalThis;
|
|
251
243
|
/**
|
|
252
244
|
* Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
|
253
245
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
246
|
+
interface Class<T, Arguments extends unknown[] = any[]> {
|
|
247
|
+
prototype: Pick<T, keyof T>;
|
|
248
|
+
new (...arguments_: Arguments): T;
|
|
257
249
|
}
|
|
258
250
|
/**
|
|
259
251
|
* Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
|
260
252
|
*/
|
|
261
|
-
|
|
253
|
+
type Constructor<T, Arguments extends unknown[] = any[]> = new (...arguments_: Arguments) => T;
|
|
262
254
|
/**
|
|
263
255
|
* Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes).
|
|
264
256
|
*
|
|
265
257
|
* @privateRemarks
|
|
266
258
|
* We cannot use a `type` here because TypeScript throws: 'abstract' modifier cannot appear on a type member. (1070)
|
|
267
259
|
*/
|
|
268
|
-
|
|
269
|
-
|
|
260
|
+
interface AbstractClass<T, Arguments extends unknown[] = any[]> extends AbstractConstructor<T, Arguments> {
|
|
261
|
+
prototype: Pick<T, keyof T>;
|
|
270
262
|
}
|
|
271
263
|
/**
|
|
272
264
|
* Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.
|
|
273
265
|
*/
|
|
274
|
-
|
|
266
|
+
type AbstractConstructor<T, Arguments extends unknown[] = any[]> = abstract new (...arguments_: Arguments) => T;
|
|
275
267
|
/**
|
|
276
268
|
* Create a tuple type of the given length `<L>` and fill it with the given type `<Fill>`.
|
|
277
269
|
*
|
|
@@ -279,7 +271,7 @@ export type AbstractConstructor<T, Arguments extends unknown[] = any[]> = abstra
|
|
|
279
271
|
*
|
|
280
272
|
* @see https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f
|
|
281
273
|
*/
|
|
282
|
-
|
|
274
|
+
type BuildTuple<L extends number, Fill = unknown, T extends readonly unknown[] = []> = T["length"] extends L ? T : BuildTuple<L, Fill, [...T, Fill]>;
|
|
283
275
|
/**
|
|
284
276
|
* Test if the given function has multiple call signatures.
|
|
285
277
|
*
|
|
@@ -288,15 +280,15 @@ export type BuildTuple<L extends number, Fill = unknown, T extends readonly unkn
|
|
|
288
280
|
* Multiple call signatures cannot currently be supported due to a TypeScript limitation.
|
|
289
281
|
* @see https://github.com/microsoft/TypeScript/issues/29732
|
|
290
282
|
*/
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
283
|
+
type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
284
|
+
(...arguments_: infer A): unknown;
|
|
285
|
+
(...arguments_: infer B): unknown;
|
|
294
286
|
} ? B extends A ? A extends B ? false : true : true : false;
|
|
295
287
|
type StructuredCloneablePrimitive = string | number | bigint | boolean | null | undefined | boolean | number | string;
|
|
296
288
|
type StructuredCloneableData = ArrayBuffer | DataView | Date | Error | RegExp | TypedArray | Blob | File;
|
|
297
289
|
type StructuredCloneableCollection = readonly StructuredCloneable[] | {
|
|
298
|
-
|
|
299
|
-
|
|
290
|
+
readonly [key: string]: StructuredCloneable;
|
|
291
|
+
readonly [key: number]: StructuredCloneable;
|
|
300
292
|
} | ReadonlyMap<StructuredCloneable, StructuredCloneable> | ReadonlySet<StructuredCloneable>;
|
|
301
293
|
/**
|
|
302
294
|
* Matches a value that can be losslessly cloned using `structuredClone`.
|
|
@@ -333,5 +325,7 @@ type StructuredCloneableCollection = readonly StructuredCloneable[] | {
|
|
|
333
325
|
* //=> {number: 3, date: Date(2022-10-17 22:22:35.920), map: Map {'key' -> 1}}
|
|
334
326
|
* ```
|
|
335
327
|
*/
|
|
336
|
-
|
|
337
|
-
|
|
328
|
+
type StructuredCloneable = StructuredCloneablePrimitive | StructuredCloneableData | StructuredCloneableCollection;
|
|
329
|
+
//#endregion
|
|
330
|
+
export { NonNullishObject as $, Filter as A, IsFunction as B, DeepPartial as C, TypedIndexable as Ct, EmptyArray as D, EMPTY_STRING as E, Identity as F, IsUndefined as G, IsNull as H, IndexType as I, MaybePromise as J, IsUnknown as K, Indexable as L, FunctionOrValue as M, GlobalThis as N, EmptyObject as O, HasMultipleCallSignatures as P, Newable as Q, IsAny as R, Constructor as S, Typed as St, EMPTY_OBJECT as T, IsNullish as U, IsNever as V, IsPrimitive as W, NativeClass as X, NEWLINE_STRING as Y, NestedValue as Z, BuiltIns as _, TYPE_MAP as _t, Any as a, Primitive as at, Clonable as b, TypeMap as bt, AnyCase as c, RequiredKeysOf as ct, AnyNumber as d, SerializablePrimitive as dt, NonRecursiveType as et, AnyString as f, SetRequired as ft, BuildTuple as g, TYPE_ARRAY as gt, BrowserNativeObject as h, TYPE_ARGUMENTS as ht, AbstractConstructor as i, PlainObject as it, FunctionLike as j, Except as k, AnyFunction as l, Rollback as lt, AtomicObject as m, StructuredCloneable as mt, Abstract as n, Nullish as nt, AnyArray as o, ReducerFunction as ot, AnyWeakMap as p, Simplify as pt, List as q, AbstractClass as r, Nullishable as rt, AnyBoolean as s, RefObject as st, $NestedValue as t, NonUndefined as tt, AnyMap as u, Sequenced as ut, Class as v, TYPE_OBJECT as vt, Dictionary as w, Versioned as wt, Collection as x, TypeTester as xt, ClassTypeCheckable as y, TYPE_SET as yt, IsEqual as z };
|
|
331
|
+
//# sourceMappingURL=base-CiIyKS-b.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-CiIyKS-b.d.mts","names":[],"sources":["../src/base.ts"],"sourcesContent":[],"mappings":";;;KAoBY,qBAAA;KAOA,SAAA,GAAY;AAPxB;AAOA;AAKA;AAAuB,KAAX,QAAA,GAAW,SAAA,GAAA,IAAA,GAAmB,IAAnB,GAA0B,MAA1B;;;;AAMX,KAAA,YAAA,GAAe,QAAH,GAAc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;AAAA;;;;;;;;;;AAmBzB;;;;;;;;AAgCJ,KA5HQ,UAAA,GA4HR,OA5H4B,UA4H5B;;AAqCJ;;AAEI,UA9Ja,KA8Jb,CAAA,CAAA,EAAA,kBAAA,OAAA,EAAA,GAAA,GAAA,EAAA,CAAA,CAAA;EACA,SAAA,EA9JS,IA8JT,CA9Jc,CA8Jd,EAAA,MA9JuB,CA8JvB,CAAA;EAA6B,KAAA,GAAA,UAAA,EA7JX,SA6JW,CAAA,EA7JC,CA6JD;;;;;KAvJrB,0EACK,cACZ;;;;;;;UASY,8DAGP,oBAAoB,GAAG;aACpB,KAAK,SAAS;;;;;KAMf,2FAGqB,cAAc;;;;;;;;KASnC,kFAIR,oBAAoB,IAAI,IAAI,WAAW,GAAG,UAAU,GAAG;;;;;;;;;KAU/C,yEAER;;;;KAWC,4BAAA;KAWA,uBAAA,GACD,cACA,WACA,OACA,QACA,SACA,aACA,OACA;KAyBC,6BAAA,YACQ;0BAEiB;0BACA;IAE1B,YAAY,qBAAqB,uBACjC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCJ,mBAAA,GACR,+BACA,0BACA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=``,t=`\r
|
|
2
|
+
`,n={},r=`Arguments`,i=`Array`,a=`Object`,o=`Map`,s=`Set`,c=Symbol(`NestedValue`);Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return`Arguments`}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return`Object`}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return`\r
|
|
3
|
+
`}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return`Set`}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return`Array`}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return``}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return`Map`}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-DmFPRVSE.mjs","names":["$NestedValue: unique symbol"],"sources":["../src/base.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { TypedArray } from \"./array\";\n\nexport type SerializablePrimitive =\n | null\n | undefined\n | string\n | number\n | boolean\n | bigint;\nexport type Primitive = SerializablePrimitive | symbol;\n\n/**\n * Matches any primitive, `void`, `Date`, or `RegExp` value.\n */\nexport type BuiltIns = Primitive | void | Date | RegExp;\n\n/**\n * Matches any non-primitive object\n */\n// eslint-disable-next-line ts/no-unsafe-function-type\nexport type AtomicObject = Function | Promise<any> | Date | RegExp;\n\n/** Determines if the passed value is of a specific type */\nexport type TypeTester = (value: any) => boolean;\n\n/**\n * The interface for a type mapping (key =\\> function) to use for {@link getType}.\n * export * The key represents the name of the type. The function represents the {@link TypeTester | test method}.\n * The map should be ordered by testing preference, with more specific tests first.\n * If a test returns true, it is selected, and the key is returned as the type.\n */\nexport type TypeMap = Record<string, TypeTester>;\n\ndeclare const emptyObjectSymbol: unique symbol;\n\nexport type FunctionOrValue<Value> = Value extends () => infer X ? X : Value;\n\n/**\n * A [[List]]\n *\n * @example\n * ```ts\n * type list0 = [1, 2, 3]\n * type list1 = number[]\n * ```\n *\n * @param A - its type\n * @returns [[List]]\n */\nexport type List<A = any> = ReadonlyArray<A>;\n\n/**\n * Alias to create a [[Function]]\n *\n * @example\n * ```ts\n * import { FunctionLike } from '@stryke/types'\n *\n * type test0 = FunctionLike<[string, number], boolean>\n * /// (args_0: string, args_1: number) => boolean\n * ```\n *\n * @param P - parameters\n * @param R - return type\n * @returns [[Function]]\n */\nexport type FunctionLike<P extends List = any, R = any> = (...args: P) => R;\n\nexport type AnyFunction = FunctionLike<any, any>;\nexport type Nullish = undefined | null;\nexport type Nullishable<T> = T | Nullish;\nexport type NonNullishObject = object; // not null/undefined which are Object\nexport type NativeClass = abstract new (...args: any) => any;\nexport type AnyNumber = number | number;\nexport type AnyString = string | string;\nexport type AnyBoolean = boolean | boolean;\nexport type AnyArray = any[];\nexport type PlainObject = Record<any, object>; // https://stackoverflow.com/a/75052315/130638\nexport type AnyMap = Map<any, any>;\nexport type AnyWeakMap = WeakMap<WeakKey, any>;\nexport type EmptyArray = [];\nexport interface EmptyObject {\n [emptyObjectSymbol]?: never;\n}\n\nexport type Any =\n | boolean\n | number\n | bigint\n | string\n | null\n | undefined\n | void\n | symbol\n | object\n | PlainObject\n | AnyArray\n | AnyMap\n | AnyWeakMap;\n\n/**\n * The valid types of the index for an `Indexable` type object\n */\nexport type IndexType = string | number | symbol;\n\n/**\n * The declaration of a ***dictionary-type*** object with a specific type\n *\n * @see {@link Indexable}\n * @see {@link IndexType}\n * @see {@link Dictionary}\n */\nexport type TypedIndexable<T> = Record<IndexType, T>;\n\n/**\n * The declaration of a ***dictionary-type*** object\n *\n * @see {@link TypedIndexable}\n * @see {@link IndexType}\n * @see {@link Dictionary}\n */\nexport type Indexable = TypedIndexable<any>;\n\n/**\n * The declaration of a ***dictionary-type*** object with a specific type\n *\n * @see {@link Indexable}\n * @see {@link IndexType}\n * @see {@link TypedIndexable}\n */\nexport type Dictionary<T> = Record<string, T>;\n\nexport const EMPTY_STRING = \"\";\nexport const NEWLINE_STRING = \"\\r\\n\";\nexport const EMPTY_OBJECT = {};\n\nexport type AnyCase<T extends IndexType> = string extends T\n ? string\n : T extends `${infer F1}${infer F2}${infer R}`\n ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${AnyCase<R>}`\n : T extends `${infer F}${infer R}`\n ? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}`\n : typeof EMPTY_STRING;\n\nexport type Newable<T> = new (..._args: never[]) => T;\n\nexport interface Abstract<T> {\n prototype: T;\n}\n\nexport interface Clonable<T> {\n clone: () => T;\n}\n\nexport type MaybePromise<T> = T | Promise<T>;\n\nexport type ReducerFunction<TState, TAction> = (\n state: TState,\n action: TAction\n) => TState;\n\n// NOTE: for the file size optimization\nexport const TYPE_ARGUMENTS = \"Arguments\";\nexport const TYPE_ARRAY = \"Array\";\nexport const TYPE_OBJECT = \"Object\";\nexport const TYPE_MAP = \"Map\";\nexport const TYPE_SET = \"Set\";\n\nexport type Collection =\n | IArguments\n | unknown[]\n | Map<unknown, unknown>\n | Record<string | number | symbol, unknown>\n | Set<unknown>;\n\nexport type NonUndefined<T> = T extends undefined ? never : T;\n\nexport type BrowserNativeObject = Date | File;\n\nexport type DeepPartial<T> = T extends BrowserNativeObject | NestedValue\n ? T\n : {\n [K in keyof T]?: DeepPartial<T[K]>;\n };\n\nexport type Rollback = Record<\n string,\n (initialValue: any, currentValue: any) => any\n>;\n\n/**\n * Extract all required keys from the given type.\n *\n * @remarks\n * This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...\n */\nexport type RequiredKeysOf<BaseType extends object> = Exclude<\n {\n [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]>\n ? Key\n : never;\n }[keyof BaseType],\n undefined\n>;\n\n/**\n * Returns a boolean for whether the two given types are equal.\n *\n * @remarks\n * Use-cases: If you want to make a conditional branch based on the result of a comparison of two types.\n *\n * @see https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650\n * @see https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796\n */\nexport type IsEqual<A, B> =\n (<G>() => G extends A ? 1 : 2) extends <G>() => G extends B ? 1 : 2\n ? true\n : false;\n\nexport type Filter<KeyType, ExcludeType> =\n IsEqual<KeyType, ExcludeType> extends true\n ? never\n : KeyType extends ExcludeType\n ? never\n : KeyType;\n\ninterface ExceptOptions {\n /**\n Disallow assigning non-specified properties.\n\n Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.\n\n @defaultValue false\n */\n requireExactProps?: boolean;\n}\n\n/**\n * Create a type from an object type without certain keys.\n *\n * @remarks\n * We recommend setting the `requireExactProps` option to `true`.\n *\n * This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.\n *\n * This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).\n */\nexport type Except<\n ObjectType,\n KeysType extends keyof ObjectType,\n Options extends ExceptOptions = { requireExactProps: false }\n> = {\n [KeyType in keyof ObjectType as Filter<\n KeyType,\n KeysType\n >]: ObjectType[KeyType];\n} & (Options[\"requireExactProps\"] extends true\n ? Partial<Record<KeysType, never>>\n : Record<string, never>);\n\n/**\n * Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.\n *\n * @remarks\n * Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.\n *\n * If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.\n *\n * @see https://github.com/microsoft/TypeScript/issues/15300\n */\nexport type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};\n\n/**\n * Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.\n *\n * @remarks\n * Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.\n */\nexport type SetRequired<\n BaseType,\n Keys extends keyof BaseType\n> = BaseType extends unknown // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types). // union into a [distributive conditional // `extends unknown` is always going to be the case and is used to convert any\n ? Simplify<\n // Pick just the keys that are optional from the base type.\n Except<BaseType, Keys> &\n // Pick the keys that should be required from the base type and make them required.\n Required<Pick<BaseType, Keys>>\n >\n : never;\n\nexport const $NestedValue: unique symbol = Symbol(\"NestedValue\");\n\nexport type NestedValue<TValue extends object = object> = {\n [$NestedValue]: never;\n} & TValue;\n\nexport interface RefObject<T> {\n current: T;\n}\n\nexport interface Identity<T = string> {\n id: T;\n}\n\nexport interface Versioned {\n version: number;\n}\n\nexport interface Sequenced {\n /**\n * The sequence number (version, or event counter, etc.) of the record\n */\n sequence: number;\n}\n\nexport interface Typed {\n /**\n * The type of the record\n */\n __type: string;\n}\n\nexport interface ClassTypeCheckable<T> extends Typed {\n /**\n * Run type check on the given value\n * @param value - The value to check\n * @returns True if the value is of the type of the class\n */\n isTypeOf: (value: unknown) => value is T;\n}\n\n/**\n * Matches non-recursive types.\n */\nexport type NonRecursiveType =\n | BuiltIns\n // eslint-disable-next-line ts/no-unsafe-function-type\n | Function\n | (new (...arguments_: any[]) => unknown);\n\nexport type IsPrimitive<T> = [T] extends [Primitive] ? true : false;\nexport type IsNever<T> = [T] extends [never] ? true : false;\nexport type IsAny<T> = 0 extends 1 & T ? true : false;\nexport type IsNull<T> = [T] extends [null] ? true : false;\nexport type IsUndefined<T> = T extends undefined ? true : false;\nexport type IsUnknown<T> = unknown extends T // `T` can be `unknown` or `any`\n ? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be\n ? true\n : false\n : false;\nexport type IsNullish<T> = IsNull<T> & IsUndefined<T>;\nexport type IsFunction<T> = T extends AnyFunction ? true : false;\n\n/**\n * Declare locally scoped properties on `globalThis`.\n *\n * When defining a global variable in a declaration file is inappropriate, it can be helpful to define a `type` or `interface` (say `ExtraGlobals`) with the global variable and then cast `globalThis` via code like `globalThis as unknown as ExtraGlobals`.\n *\n * Instead of casting through `unknown`, you can update your `type` or `interface` to extend `GlobalThis` and then directly cast `globalThis`.\n *\n * @example\n * ```\n * import type { GlobalThis } from '@stryke/types';\n *\n * type ExtraGlobals = GlobalThis & {\n * readonly GLOBAL_TOKEN: string;\n * };\n *\n * (globalThis as ExtraGlobals).GLOBAL_TOKEN;\n * ```\n */\nexport type GlobalThis = typeof globalThis;\n\n/**\n * Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n */\nexport interface Class<T, Arguments extends unknown[] = any[]> {\n prototype: Pick<T, keyof T>;\n new (...arguments_: Arguments): T;\n}\n\n/**\n * Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n */\nexport type Constructor<T, Arguments extends unknown[] = any[]> = new (\n ...arguments_: Arguments\n) => T;\n\n/**\n * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes).\n *\n * @privateRemarks\n * We cannot use a `type` here because TypeScript throws: 'abstract' modifier cannot appear on a type member. (1070)\n */\n\nexport interface AbstractClass<\n T,\n Arguments extends unknown[] = any[]\n> extends AbstractConstructor<T, Arguments> {\n prototype: Pick<T, keyof T>;\n}\n\n/**\n * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.\n */\nexport type AbstractConstructor<\n T,\n Arguments extends unknown[] = any[]\n> = abstract new (...arguments_: Arguments) => T;\n\n/**\n * Create a tuple type of the given length `<L>` and fill it with the given type `<Fill>`.\n *\n * If `<Fill>` is not provided, it will default to `unknown`.\n *\n * @see https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f\n */\nexport type BuildTuple<\n L extends number,\n Fill = unknown,\n T extends readonly unknown[] = []\n> = T[\"length\"] extends L ? T : BuildTuple<L, Fill, [...T, Fill]>;\n\n/**\n * Test if the given function has multiple call signatures.\n *\n * Needed to handle the case of a single call signature with properties.\n *\n * Multiple call signatures cannot currently be supported due to a TypeScript limitation.\n * @see https://github.com/microsoft/TypeScript/issues/29732\n */\nexport type HasMultipleCallSignatures<\n T extends (...arguments_: any[]) => unknown\n> = T extends {\n (...arguments_: infer A): unknown;\n (...arguments_: infer B): unknown;\n}\n ? B extends A\n ? A extends B\n ? false\n : true\n : true\n : false;\n\ntype StructuredCloneablePrimitive =\n | string\n | number\n | bigint\n | boolean\n | null\n | undefined\n | boolean\n | number\n | string;\n\ntype StructuredCloneableData =\n | ArrayBuffer\n | DataView\n | Date\n | Error\n | RegExp\n | TypedArray\n | Blob\n | File;\n\n// DOM exclusive types\n// | AudioData\n// | CropTarget\n// | CryptoKey\n// | DOMException\n// | DOMMatrix\n// | DOMMatrixReadOnly\n// | DOMPoint\n// | DOMPointReadOnly\n// | DOMQuad\n// | DOMRect\n// | DOMRectReadOnly\n// | FileList\n// | FileSystemDirectoryHandle\n// | FileSystemFileHandle\n// | FileSystemHandle\n// | GPUCompilationInfo\n// | GPUCompilationMessage\n// | ImageBitmap\n// | ImageData\n// | RTCCertificate\n// | VideoFrame\n\ntype StructuredCloneableCollection =\n | readonly StructuredCloneable[]\n | {\n readonly [key: string]: StructuredCloneable;\n readonly [key: number]: StructuredCloneable;\n }\n | ReadonlyMap<StructuredCloneable, StructuredCloneable>\n | ReadonlySet<StructuredCloneable>;\n\n/**\n * Matches a value that can be losslessly cloned using `structuredClone`.\n *\n * Note:\n * - Custom error types will be cloned as the base `Error` type\n * - This type doesn't include types exclusive to the TypeScript DOM library (e.g. `DOMRect` and `VideoFrame`)\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n *\n * @example\n * ```\n * import type { StructuredCloneable } from '@stryke/types';\n *\n * class CustomClass {}\n *\n * // @ts-expect-error\n * const error: StructuredCloneable = {\n * custom: new CustomClass(),\n * };\n *\n * structuredClone(error);\n * //=> {custom: {}}\n *\n * const good: StructuredCloneable = {\n * number: 3,\n * date: new Date(),\n * map: new Map<string, number>(),\n * }\n *\n * good.map.set('key', 1);\n *\n * structuredClone(good);\n * //=> {number: 3, date: Date(2022-10-17 22:22:35.920), map: Map {'key' -> 1}}\n * ```\n */\nexport type StructuredCloneable =\n | StructuredCloneablePrimitive\n | StructuredCloneableData\n | StructuredCloneableCollection;\n"],"mappings":"AAsJA,MAAa,EAAe,GACf,EAAiB;EACjB,EAAe,EAAE,CA4BjB,EAAiB,YACjB,EAAa,QACb,EAAc,SACd,EAAW,MACX,EAAW,MA4HXA,EAA8B,OAAO,cAAc"}
|