@stryke/types 0.10.23 → 0.10.24

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.
Files changed (163) hide show
  1. package/dist/array.d.cts +122 -2
  2. package/dist/array.d.cts.map +1 -0
  3. package/dist/array.d.mts +122 -2
  4. package/dist/array.d.mts.map +1 -0
  5. package/dist/async.d.cts +111 -2
  6. package/dist/async.d.cts.map +1 -0
  7. package/dist/async.d.mts +111 -2
  8. package/dist/async.d.mts.map +1 -0
  9. package/dist/base.cjs +3 -1
  10. package/dist/base.d.cts +331 -2
  11. package/dist/base.d.cts.map +1 -0
  12. package/dist/base.d.mts +331 -2
  13. package/dist/base.d.mts.map +1 -0
  14. package/dist/base.mjs +3 -1
  15. package/dist/base.mjs.map +1 -0
  16. package/dist/configuration.d.cts +71 -2
  17. package/dist/configuration.d.cts.map +1 -0
  18. package/dist/configuration.d.mts +71 -2
  19. package/dist/configuration.d.mts.map +1 -0
  20. package/dist/file.d.cts +51 -2
  21. package/dist/file.d.cts.map +1 -0
  22. package/dist/file.d.mts +51 -2
  23. package/dist/file.d.mts.map +1 -0
  24. package/dist/form.d.cts +40 -2
  25. package/dist/form.d.cts.map +1 -0
  26. package/dist/form.d.mts +40 -2
  27. package/dist/form.d.mts.map +1 -0
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.cts +19 -18
  30. package/dist/index.d.mts +19 -18
  31. package/dist/index.mjs +1 -1
  32. package/dist/json.d.cts +70 -2
  33. package/dist/json.d.cts.map +1 -0
  34. package/dist/json.d.mts +70 -2
  35. package/dist/json.d.mts.map +1 -0
  36. package/dist/logic.d.cts +124 -2
  37. package/dist/logic.d.cts.map +1 -0
  38. package/dist/logic.d.mts +124 -2
  39. package/dist/logic.d.mts.map +1 -0
  40. package/dist/messages.d.cts +21 -2
  41. package/dist/messages.d.cts.map +1 -0
  42. package/dist/messages.d.mts +21 -2
  43. package/dist/messages.d.mts.map +1 -0
  44. package/dist/navigator.d.cts +42 -2
  45. package/dist/navigator.d.cts.map +1 -0
  46. package/dist/navigator.d.mts +42 -2
  47. package/dist/navigator.d.mts.map +1 -0
  48. package/dist/number.d.cts +181 -2
  49. package/dist/number.d.cts.map +1 -0
  50. package/dist/number.d.mts +181 -2
  51. package/dist/number.d.mts.map +1 -0
  52. package/dist/object.d.cts +394 -2
  53. package/dist/object.d.cts.map +1 -0
  54. package/dist/object.d.mts +394 -2
  55. package/dist/object.d.mts.map +1 -0
  56. package/dist/package-json.d.cts +261 -2
  57. package/dist/package-json.d.cts.map +1 -0
  58. package/dist/package-json.d.mts +261 -2
  59. package/dist/package-json.d.mts.map +1 -0
  60. package/dist/package-manager.d.cts +6 -2
  61. package/dist/package-manager.d.cts.map +1 -0
  62. package/dist/package-manager.d.mts +6 -2
  63. package/dist/package-manager.d.mts.map +1 -0
  64. package/dist/string.d.cts +81 -2
  65. package/dist/string.d.cts.map +1 -0
  66. package/dist/string.d.mts +81 -2
  67. package/dist/string.d.mts.map +1 -0
  68. package/dist/system.d.cts +5 -2
  69. package/dist/system.d.cts.map +1 -0
  70. package/dist/system.d.mts +5 -2
  71. package/dist/system.d.mts.map +1 -0
  72. package/dist/tsconfig.d.cts +803 -2
  73. package/dist/tsconfig.d.cts.map +1 -0
  74. package/dist/tsconfig.d.mts +803 -2
  75. package/dist/tsconfig.d.mts.map +1 -0
  76. package/dist/user.d.cts +29 -2
  77. package/dist/user.d.cts.map +1 -0
  78. package/dist/user.d.mts +29 -2
  79. package/dist/user.d.mts.map +1 -0
  80. package/dist/utilities.d.cts +51 -2
  81. package/dist/utilities.d.cts.map +1 -0
  82. package/dist/utilities.d.mts +51 -2
  83. package/dist/utilities.d.mts.map +1 -0
  84. package/dist/validations.d.cts +21 -2
  85. package/dist/validations.d.cts.map +1 -0
  86. package/dist/validations.d.mts +21 -2
  87. package/dist/validations.d.mts.map +1 -0
  88. package/package.json +3 -3
  89. package/dist/array-DVtfX_TI.d.mts +0 -122
  90. package/dist/array-DVtfX_TI.d.mts.map +0 -1
  91. package/dist/array-DtIKbcDr.d.cts +0 -122
  92. package/dist/array-DtIKbcDr.d.cts.map +0 -1
  93. package/dist/async-BtPWg6IL.d.mts +0 -111
  94. package/dist/async-BtPWg6IL.d.mts.map +0 -1
  95. package/dist/async-eKWh-_sF.d.cts +0 -111
  96. package/dist/async-eKWh-_sF.d.cts.map +0 -1
  97. package/dist/base-CiIyKS-b.d.mts +0 -331
  98. package/dist/base-CiIyKS-b.d.mts.map +0 -1
  99. package/dist/base-Cpeh4C5c.cjs +0 -3
  100. package/dist/base-DmFPRVSE.mjs +0 -3
  101. package/dist/base-DmFPRVSE.mjs.map +0 -1
  102. package/dist/base-EF17pdAI.d.cts +0 -331
  103. package/dist/base-EF17pdAI.d.cts.map +0 -1
  104. package/dist/configuration-5Q2wg3Id.d.mts +0 -71
  105. package/dist/configuration-5Q2wg3Id.d.mts.map +0 -1
  106. package/dist/configuration-Dvz7q6dd.d.cts +0 -71
  107. package/dist/configuration-Dvz7q6dd.d.cts.map +0 -1
  108. package/dist/file-dM8RAMNC.d.cts +0 -51
  109. package/dist/file-dM8RAMNC.d.cts.map +0 -1
  110. package/dist/file-eWushyiM.d.mts +0 -51
  111. package/dist/file-eWushyiM.d.mts.map +0 -1
  112. package/dist/form-mTzpZCeA.d.cts +0 -40
  113. package/dist/form-mTzpZCeA.d.cts.map +0 -1
  114. package/dist/form-sNCVXIEk.d.mts +0 -40
  115. package/dist/form-sNCVXIEk.d.mts.map +0 -1
  116. package/dist/json-BlaU0Pbq.d.cts +0 -70
  117. package/dist/json-BlaU0Pbq.d.cts.map +0 -1
  118. package/dist/json-C3wqh2t3.d.mts +0 -70
  119. package/dist/json-C3wqh2t3.d.mts.map +0 -1
  120. package/dist/logic-BoEG5A3-.d.cts +0 -374
  121. package/dist/logic-BoEG5A3-.d.cts.map +0 -1
  122. package/dist/logic-h9Jrrpsk.d.mts +0 -374
  123. package/dist/logic-h9Jrrpsk.d.mts.map +0 -1
  124. package/dist/messages-Bxu_o13x.d.mts +0 -21
  125. package/dist/messages-Bxu_o13x.d.mts.map +0 -1
  126. package/dist/messages-PtLJRJeN.d.cts +0 -21
  127. package/dist/messages-PtLJRJeN.d.cts.map +0 -1
  128. package/dist/navigator-DLpMW73v.d.mts +0 -42
  129. package/dist/navigator-DLpMW73v.d.mts.map +0 -1
  130. package/dist/navigator-wsxMUGqK.d.cts +0 -42
  131. package/dist/navigator-wsxMUGqK.d.cts.map +0 -1
  132. package/dist/object-B3Rc0f80.d.mts +0 -392
  133. package/dist/object-B3Rc0f80.d.mts.map +0 -1
  134. package/dist/object-DyLgFijN.d.cts +0 -392
  135. package/dist/object-DyLgFijN.d.cts.map +0 -1
  136. package/dist/package-json-BYMmXu4B.d.mts +0 -261
  137. package/dist/package-json-BYMmXu4B.d.mts.map +0 -1
  138. package/dist/package-json-DMeUqEmW.d.cts +0 -261
  139. package/dist/package-json-DMeUqEmW.d.cts.map +0 -1
  140. package/dist/package-manager-PRcovqs-.d.mts +0 -6
  141. package/dist/package-manager-PRcovqs-.d.mts.map +0 -1
  142. package/dist/package-manager-tcG2TLVT.d.cts +0 -6
  143. package/dist/package-manager-tcG2TLVT.d.cts.map +0 -1
  144. package/dist/system-BxYi2_rE.d.mts +0 -5
  145. package/dist/system-BxYi2_rE.d.mts.map +0 -1
  146. package/dist/system-n1LPjzuJ.d.cts +0 -5
  147. package/dist/system-n1LPjzuJ.d.cts.map +0 -1
  148. package/dist/tsconfig-C6dWY2RO.d.cts +0 -803
  149. package/dist/tsconfig-C6dWY2RO.d.cts.map +0 -1
  150. package/dist/tsconfig-CUKA7cEN.d.mts +0 -803
  151. package/dist/tsconfig-CUKA7cEN.d.mts.map +0 -1
  152. package/dist/user-CkdO4wnf.d.mts +0 -29
  153. package/dist/user-CkdO4wnf.d.mts.map +0 -1
  154. package/dist/user-CovHR6Ne.d.cts +0 -29
  155. package/dist/user-CovHR6Ne.d.cts.map +0 -1
  156. package/dist/utilities-BVS-gcgS.d.mts +0 -51
  157. package/dist/utilities-BVS-gcgS.d.mts.map +0 -1
  158. package/dist/utilities-Jb4ggdM-.d.cts +0 -51
  159. package/dist/utilities-Jb4ggdM-.d.cts.map +0 -1
  160. package/dist/validations-C_7osVpS.d.mts +0 -21
  161. package/dist/validations-C_7osVpS.d.mts.map +0 -1
  162. package/dist/validations-CvwxY4RE.d.cts +0 -21
  163. package/dist/validations-CvwxY4RE.d.cts.map +0 -1
package/dist/base.d.cts CHANGED
@@ -1,2 +1,331 @@
1
- import { $ as NonNullishObject, A as Filter, B as IsFunction, C as DeepPartial, Ct as TypedIndexable, D as EmptyArray, E as EMPTY_STRING, F as Identity, G as IsUndefined, H as IsNull, I as IndexType, J as MaybePromise, K as IsUnknown, L as Indexable, M as FunctionOrValue, N as GlobalThis, O as EmptyObject, P as HasMultipleCallSignatures, Q as Newable, R as IsAny, S as Constructor, St as Typed, T as EMPTY_OBJECT, U as IsNullish, V as IsNever, W as IsPrimitive, X as NativeClass, Y as NEWLINE_STRING, Z as NestedValue, _ as BuiltIns, _t as TYPE_MAP, a as Any, at as Primitive, b as Clonable, bt as TypeMap, c as AnyCase, ct as RequiredKeysOf, d as AnyNumber, dt as SerializablePrimitive, et as NonRecursiveType, f as AnyString, ft as SetRequired, g as BuildTuple, gt as TYPE_ARRAY, h as BrowserNativeObject, ht as TYPE_ARGUMENTS, i as AbstractConstructor, it as PlainObject, j as FunctionLike, k as Except, l as AnyFunction, lt as Rollback, m as AtomicObject, mt as StructuredCloneable, n as Abstract, nt as Nullish, o as AnyArray, ot as ReducerFunction, p as AnyWeakMap, pt as Simplify, q as List, r as AbstractClass, rt as Nullishable, s as AnyBoolean, st as RefObject, t as $NestedValue, tt as NonUndefined, u as AnyMap, ut as Sequenced, v as Class, vt as TYPE_OBJECT, w as Dictionary, wt as Versioned, x as Collection, xt as TypeTester, y as ClassTypeCheckable, yt as TYPE_SET, z as IsEqual } from "./base-EF17pdAI.cjs";
2
- export { $NestedValue, Abstract, AbstractClass, AbstractConstructor, Any, AnyArray, AnyBoolean, AnyCase, AnyFunction, AnyMap, AnyNumber, AnyString, AnyWeakMap, AtomicObject, BrowserNativeObject, BuildTuple, BuiltIns, Class, ClassTypeCheckable, Clonable, Collection, Constructor, DeepPartial, Dictionary, EMPTY_OBJECT, EMPTY_STRING, EmptyArray, EmptyObject, Except, Filter, FunctionLike, FunctionOrValue, GlobalThis, HasMultipleCallSignatures, Identity, IndexType, Indexable, IsAny, IsEqual, IsFunction, IsNever, IsNull, IsNullish, IsPrimitive, IsUndefined, IsUnknown, List, MaybePromise, NEWLINE_STRING, NativeClass, NestedValue, Newable, NonNullishObject, NonRecursiveType, NonUndefined, Nullish, Nullishable, PlainObject, Primitive, ReducerFunction, RefObject, RequiredKeysOf, Rollback, Sequenced, SerializablePrimitive, SetRequired, Simplify, StructuredCloneable, TYPE_ARGUMENTS, TYPE_ARRAY, TYPE_MAP, TYPE_OBJECT, TYPE_SET, TypeMap, TypeTester, Typed, TypedIndexable, Versioned };
1
+ import { TypedArray } from "./array.cjs";
2
+
3
+ //#region src/base.d.ts
4
+ type SerializablePrimitive = null | undefined | string | number | boolean | bigint;
5
+ type Primitive = SerializablePrimitive | symbol;
6
+ /**
7
+ * Matches any primitive, `void`, `Date`, or `RegExp` value.
8
+ */
9
+ type BuiltIns = Primitive | void | Date | RegExp;
10
+ /**
11
+ * Matches any non-primitive object
12
+ */
13
+ type AtomicObject = Function | Promise<any> | Date | RegExp;
14
+ /** Determines if the passed value is of a specific type */
15
+ type TypeTester = (value: any) => boolean;
16
+ /**
17
+ * The interface for a type mapping (key =\> function) to use for {@link getType}.
18
+ * export * The key represents the name of the type. The function represents the {@link TypeTester | test method}.
19
+ * The map should be ordered by testing preference, with more specific tests first.
20
+ * If a test returns true, it is selected, and the key is returned as the type.
21
+ */
22
+ type TypeMap = Record<string, TypeTester>;
23
+ declare const emptyObjectSymbol: unique symbol;
24
+ type FunctionOrValue<Value> = Value extends (() => infer X) ? X : Value;
25
+ /**
26
+ * A [[List]]
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * type list0 = [1, 2, 3]
31
+ * type list1 = number[]
32
+ * ```
33
+ *
34
+ * @param A - its type
35
+ * @returns [[List]]
36
+ */
37
+ type List<A = any> = ReadonlyArray<A>;
38
+ /**
39
+ * Alias to create a [[Function]]
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * import { FunctionLike } from '@stryke/types'
44
+ *
45
+ * type test0 = FunctionLike<[string, number], boolean>
46
+ * /// (args_0: string, args_1: number) => boolean
47
+ * ```
48
+ *
49
+ * @param P - parameters
50
+ * @param R - return type
51
+ * @returns [[Function]]
52
+ */
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;
69
+ }
70
+ type Any = boolean | number | bigint | string | null | undefined | void | symbol | object | PlainObject | AnyArray | AnyMap | AnyWeakMap;
71
+ /**
72
+ * The valid types of the index for an `Indexable` type object
73
+ */
74
+ type IndexType = string | number | symbol;
75
+ /**
76
+ * The declaration of a ***dictionary-type*** object with a specific type
77
+ *
78
+ * @see {@link Indexable}
79
+ * @see {@link IndexType}
80
+ * @see {@link Dictionary}
81
+ */
82
+ type TypedIndexable<T> = Record<IndexType, T>;
83
+ /**
84
+ * The declaration of a ***dictionary-type*** object
85
+ *
86
+ * @see {@link TypedIndexable}
87
+ * @see {@link IndexType}
88
+ * @see {@link Dictionary}
89
+ */
90
+ type Indexable = TypedIndexable<any>;
91
+ /**
92
+ * The declaration of a ***dictionary-type*** object with a specific type
93
+ *
94
+ * @see {@link Indexable}
95
+ * @see {@link IndexType}
96
+ * @see {@link TypedIndexable}
97
+ */
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;
106
+ }
107
+ interface Clonable<T> {
108
+ clone: () => T;
109
+ }
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
+ /**
123
+ * Extract all required keys from the given type.
124
+ *
125
+ * @remarks
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
+ */
128
+ type RequiredKeysOf<BaseType extends object> = Exclude<{ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never }[keyof BaseType], undefined>;
129
+ /**
130
+ * Returns a boolean for whether the two given types are equal.
131
+ *
132
+ * @remarks
133
+ * Use-cases: If you want to make a conditional branch based on the result of a comparison of two types.
134
+ *
135
+ * @see https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
136
+ * @see https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
137
+ */
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;
140
+ interface ExceptOptions {
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;
147
+ }
148
+ /**
149
+ * Create a type from an object type without certain keys.
150
+ *
151
+ * @remarks
152
+ * We recommend setting the `requireExactProps` option to `true`.
153
+ *
154
+ * 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.
155
+ *
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)).
157
+ */
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>);
161
+ /**
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.
163
+ *
164
+ * @remarks
165
+ * 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.
166
+ *
167
+ * 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`.
168
+ *
169
+ * @see https://github.com/microsoft/TypeScript/issues/15300
170
+ */
171
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
172
+ /**
173
+ * Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.
174
+ *
175
+ * @remarks
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.
177
+ */
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;
182
+ } & TValue;
183
+ interface RefObject<T> {
184
+ current: T;
185
+ }
186
+ interface Identity<T = string> {
187
+ id: T;
188
+ }
189
+ interface Versioned {
190
+ version: number;
191
+ }
192
+ interface Sequenced {
193
+ /**
194
+ * The sequence number (version, or event counter, etc.) of the record
195
+ */
196
+ sequence: number;
197
+ }
198
+ interface Typed {
199
+ /**
200
+ * The type of the record
201
+ */
202
+ __type: string;
203
+ }
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;
211
+ }
212
+ /**
213
+ * Matches non-recursive types.
214
+ */
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;
224
+ /**
225
+ * Declare locally scoped properties on `globalThis`.
226
+ *
227
+ * 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`.
228
+ *
229
+ * Instead of casting through `unknown`, you can update your `type` or `interface` to extend `GlobalThis` and then directly cast `globalThis`.
230
+ *
231
+ * @example
232
+ * ```
233
+ * import type { GlobalThis } from '@stryke/types';
234
+ *
235
+ * type ExtraGlobals = GlobalThis & {
236
+ * readonly GLOBAL_TOKEN: string;
237
+ * };
238
+ *
239
+ * (globalThis as ExtraGlobals).GLOBAL_TOKEN;
240
+ * ```
241
+ */
242
+ type GlobalThis = typeof globalThis;
243
+ /**
244
+ * Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
245
+ */
246
+ interface Class<T, Arguments extends unknown[] = any[]> {
247
+ prototype: Pick<T, keyof T>;
248
+ new (...arguments_: Arguments): T;
249
+ }
250
+ /**
251
+ * Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
252
+ */
253
+ type Constructor<T, Arguments extends unknown[] = any[]> = new (...arguments_: Arguments) => T;
254
+ /**
255
+ * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes).
256
+ *
257
+ * @privateRemarks
258
+ * We cannot use a `type` here because TypeScript throws: 'abstract' modifier cannot appear on a type member. (1070)
259
+ */
260
+ interface AbstractClass<T, Arguments extends unknown[] = any[]> extends AbstractConstructor<T, Arguments> {
261
+ prototype: Pick<T, keyof T>;
262
+ }
263
+ /**
264
+ * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.
265
+ */
266
+ type AbstractConstructor<T, Arguments extends unknown[] = any[]> = abstract new (...arguments_: Arguments) => T;
267
+ /**
268
+ * Create a tuple type of the given length `<L>` and fill it with the given type `<Fill>`.
269
+ *
270
+ * If `<Fill>` is not provided, it will default to `unknown`.
271
+ *
272
+ * @see https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f
273
+ */
274
+ type BuildTuple<L extends number, Fill = unknown, T extends readonly unknown[] = []> = T["length"] extends L ? T : BuildTuple<L, Fill, [...T, Fill]>;
275
+ /**
276
+ * Test if the given function has multiple call signatures.
277
+ *
278
+ * Needed to handle the case of a single call signature with properties.
279
+ *
280
+ * Multiple call signatures cannot currently be supported due to a TypeScript limitation.
281
+ * @see https://github.com/microsoft/TypeScript/issues/29732
282
+ */
283
+ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
284
+ (...arguments_: infer A): unknown;
285
+ (...arguments_: infer B): unknown;
286
+ } ? B extends A ? A extends B ? false : true : true : false;
287
+ type StructuredCloneablePrimitive = string | number | bigint | boolean | null | undefined | boolean | number | string;
288
+ type StructuredCloneableData = ArrayBuffer | DataView | Date | Error | RegExp | TypedArray | Blob | File;
289
+ type StructuredCloneableCollection = readonly StructuredCloneable[] | {
290
+ readonly [key: string]: StructuredCloneable;
291
+ readonly [key: number]: StructuredCloneable;
292
+ } | ReadonlyMap<StructuredCloneable, StructuredCloneable> | ReadonlySet<StructuredCloneable>;
293
+ /**
294
+ * Matches a value that can be losslessly cloned using `structuredClone`.
295
+ *
296
+ * Note:
297
+ * - Custom error types will be cloned as the base `Error` type
298
+ * - This type doesn't include types exclusive to the TypeScript DOM library (e.g. `DOMRect` and `VideoFrame`)
299
+ *
300
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
301
+ *
302
+ * @example
303
+ * ```
304
+ * import type { StructuredCloneable } from '@stryke/types';
305
+ *
306
+ * class CustomClass {}
307
+ *
308
+ * // @ts-expect-error
309
+ * const error: StructuredCloneable = {
310
+ * custom: new CustomClass(),
311
+ * };
312
+ *
313
+ * structuredClone(error);
314
+ * //=> {custom: {}}
315
+ *
316
+ * const good: StructuredCloneable = {
317
+ * number: 3,
318
+ * date: new Date(),
319
+ * map: new Map<string, number>(),
320
+ * }
321
+ *
322
+ * good.map.set('key', 1);
323
+ *
324
+ * structuredClone(good);
325
+ * //=> {number: 3, date: Date(2022-10-17 22:22:35.920), map: Map {'key' -> 1}}
326
+ * ```
327
+ */
328
+ type StructuredCloneable = StructuredCloneablePrimitive | StructuredCloneableData | StructuredCloneableCollection;
329
+ //#endregion
330
+ export { $NestedValue, Abstract, AbstractClass, AbstractConstructor, Any, AnyArray, AnyBoolean, AnyCase, AnyFunction, AnyMap, AnyNumber, AnyString, AnyWeakMap, AtomicObject, BrowserNativeObject, BuildTuple, BuiltIns, Class, ClassTypeCheckable, Clonable, Collection, Constructor, DeepPartial, Dictionary, EMPTY_OBJECT, EMPTY_STRING, EmptyArray, EmptyObject, Except, Filter, FunctionLike, FunctionOrValue, GlobalThis, HasMultipleCallSignatures, Identity, IndexType, Indexable, IsAny, IsEqual, IsFunction, IsNever, IsNull, IsNullish, IsPrimitive, IsUndefined, IsUnknown, List, MaybePromise, NEWLINE_STRING, NativeClass, NestedValue, Newable, NonNullishObject, NonRecursiveType, NonUndefined, Nullish, Nullishable, PlainObject, Primitive, ReducerFunction, RefObject, RequiredKeysOf, Rollback, Sequenced, SerializablePrimitive, SetRequired, Simplify, StructuredCloneable, TYPE_ARGUMENTS, TYPE_ARRAY, TYPE_MAP, TYPE_OBJECT, TYPE_SET, TypeMap, TypeTester, Typed, TypedIndexable, Versioned };
331
+ //# sourceMappingURL=base.d.cts.map
@@ -0,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