@regle/core 1.8.5 → 1.9.0-beta.1
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/dist/regle-core.d.ts +495 -378
- package/dist/regle-core.js +243 -135
- package/dist/regle-core.min.js +1 -1
- package/package.json +9 -14
package/dist/regle-core.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ type NoInferLegacy<A extends any> = [A][A extends any ? 0 : never];
|
|
|
25
25
|
type ArrayElement<T> = T extends Array<infer U> ? U : never;
|
|
26
26
|
type NonEmptyTuple<T> = [T, ...T[]] | T[];
|
|
27
27
|
//#endregion
|
|
28
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
28
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/primitive.d.ts
|
|
29
29
|
/**
|
|
30
30
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
31
31
|
|
|
@@ -33,27 +33,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
|
|
|
33
33
|
*/
|
|
34
34
|
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
37
|
-
declare global {
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
39
|
-
interface SymbolConstructor {
|
|
40
|
-
readonly observable: symbol;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
@remarks
|
|
46
|
-
The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
|
|
47
|
-
As well, some guidance on making an `Observable` to not include `closed` property.
|
|
48
|
-
@see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
|
|
49
|
-
@see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
|
|
50
|
-
@see https://github.com/benlesh/symbol-observable#making-an-object-observable
|
|
51
|
-
|
|
52
|
-
@category Observable
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/union-to-intersection.d.ts
|
|
36
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/union-to-intersection.d.ts
|
|
57
37
|
/**
|
|
58
38
|
Convert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
59
39
|
|
|
@@ -115,7 +95,7 @@ Union extends unknown
|
|
|
115
95
|
// The `& Union` is to allow indexing by the resulting type
|
|
116
96
|
? Intersection & Union : never;
|
|
117
97
|
//#endregion
|
|
118
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
98
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/empty-object.d.ts
|
|
119
99
|
declare const emptyObjectSymbol: unique symbol;
|
|
120
100
|
|
|
121
101
|
/**
|
|
@@ -147,7 +127,6 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
|
|
|
147
127
|
type EmptyObject = {
|
|
148
128
|
[emptyObjectSymbol]?: never;
|
|
149
129
|
};
|
|
150
|
-
|
|
151
130
|
/**
|
|
152
131
|
Returns a `boolean` for whether the type is strictly equal to an empty plain object, the `{}` value.
|
|
153
132
|
|
|
@@ -165,7 +144,81 @@ type Fail = IsEmptyObject<null>; //=> false
|
|
|
165
144
|
*/
|
|
166
145
|
type IsEmptyObject<T> = T extends EmptyObject ? true : false;
|
|
167
146
|
//#endregion
|
|
168
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
147
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-any.d.ts
|
|
148
|
+
/**
|
|
149
|
+
Returns a boolean for whether the given type is `any`.
|
|
150
|
+
|
|
151
|
+
@link https://stackoverflow.com/a/49928360/1490091
|
|
152
|
+
|
|
153
|
+
Useful in type utilities, such as disallowing `any`s to be passed to a function.
|
|
154
|
+
|
|
155
|
+
@example
|
|
156
|
+
```
|
|
157
|
+
import type {IsAny} from 'type-fest';
|
|
158
|
+
|
|
159
|
+
const typedObject = {a: 1, b: 2} as const;
|
|
160
|
+
const anyObject: any = {a: 1, b: 2};
|
|
161
|
+
|
|
162
|
+
function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
|
|
163
|
+
return obj[key];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const typedA = get(typedObject, 'a');
|
|
167
|
+
//=> 1
|
|
168
|
+
|
|
169
|
+
const anyA = get(anyObject, 'a');
|
|
170
|
+
//=> any
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
@category Type Guard
|
|
174
|
+
@category Utilities
|
|
175
|
+
*/
|
|
176
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
179
|
+
/**
|
|
180
|
+
Returns a boolean for whether the given key is an optional key of type.
|
|
181
|
+
|
|
182
|
+
This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
|
|
183
|
+
|
|
184
|
+
@example
|
|
185
|
+
```
|
|
186
|
+
import type {IsOptionalKeyOf} from 'type-fest';
|
|
187
|
+
|
|
188
|
+
interface User {
|
|
189
|
+
name: string;
|
|
190
|
+
surname: string;
|
|
191
|
+
|
|
192
|
+
luckyNumber?: number;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface Admin {
|
|
196
|
+
name: string;
|
|
197
|
+
surname?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
|
|
201
|
+
//=> true
|
|
202
|
+
|
|
203
|
+
type T2 = IsOptionalKeyOf<User, 'name'>;
|
|
204
|
+
//=> false
|
|
205
|
+
|
|
206
|
+
type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
|
|
207
|
+
//=> boolean
|
|
208
|
+
|
|
209
|
+
type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
|
|
210
|
+
//=> false
|
|
211
|
+
|
|
212
|
+
type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
213
|
+
//=> boolean
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
@category Type Guard
|
|
217
|
+
@category Utilities
|
|
218
|
+
*/
|
|
219
|
+
type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
169
222
|
/**
|
|
170
223
|
Extract all optional keys from the given type.
|
|
171
224
|
|
|
@@ -199,11 +252,11 @@ const update2: UpdateOperation<User> = {
|
|
|
199
252
|
|
|
200
253
|
@category Utilities
|
|
201
254
|
*/
|
|
202
|
-
type OptionalKeysOf<
|
|
203
|
-
? (keyof { [Key in keyof
|
|
204
|
-
: never;
|
|
255
|
+
type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
256
|
+
? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
|
|
257
|
+
: never;
|
|
205
258
|
//#endregion
|
|
206
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
259
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
207
260
|
/**
|
|
208
261
|
Extract all required keys from the given type.
|
|
209
262
|
|
|
@@ -228,11 +281,10 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
|
|
|
228
281
|
|
|
229
282
|
@category Utilities
|
|
230
283
|
*/
|
|
231
|
-
type RequiredKeysOf<
|
|
232
|
-
? Exclude<keyof
|
|
233
|
-
|
|
284
|
+
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
285
|
+
? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
|
|
234
286
|
//#endregion
|
|
235
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
287
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-never.d.ts
|
|
236
288
|
/**
|
|
237
289
|
Returns a boolean for whether the given type is `never`.
|
|
238
290
|
|
|
@@ -276,124 +328,174 @@ endIfEqual('abc', '123');
|
|
|
276
328
|
*/
|
|
277
329
|
type IsNever$1<T> = [T] extends [never] ? true : false;
|
|
278
330
|
//#endregion
|
|
279
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
331
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/if.d.ts
|
|
280
332
|
/**
|
|
281
|
-
An if-else-like type that resolves depending on whether the given type is `
|
|
333
|
+
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
334
|
+
|
|
335
|
+
Use-cases:
|
|
336
|
+
- You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
|
|
282
337
|
|
|
283
|
-
|
|
338
|
+
Note:
|
|
339
|
+
- Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
|
|
340
|
+
- Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
|
|
284
341
|
|
|
285
342
|
@example
|
|
286
343
|
```
|
|
287
|
-
import
|
|
344
|
+
import {If} from 'type-fest';
|
|
288
345
|
|
|
289
|
-
type
|
|
290
|
-
//=>
|
|
291
|
-
|
|
292
|
-
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
293
|
-
//=> 'bar'
|
|
294
|
-
```
|
|
346
|
+
type A = If<true, 'yes', 'no'>;
|
|
347
|
+
//=> 'yes'
|
|
295
348
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
*/
|
|
299
|
-
type IfNever$1<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever$1<T> extends true ? TypeIfNever : TypeIfNotNever);
|
|
300
|
-
//#endregion
|
|
301
|
-
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
|
|
302
|
-
// Can eventually be replaced with the built-in once this library supports
|
|
303
|
-
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
304
|
-
type NoInfer<T> = T extends infer U ? U : never;
|
|
349
|
+
type B = If<false, 'yes', 'no'>;
|
|
350
|
+
//=> 'no'
|
|
305
351
|
|
|
306
|
-
|
|
307
|
-
|
|
352
|
+
type C = If<boolean, 'yes', 'no'>;
|
|
353
|
+
//=> 'yes' | 'no'
|
|
308
354
|
|
|
309
|
-
|
|
355
|
+
type D = If<any, 'yes', 'no'>;
|
|
356
|
+
//=> 'yes' | 'no'
|
|
310
357
|
|
|
311
|
-
|
|
358
|
+
type E = If<never, 'yes', 'no'>;
|
|
359
|
+
//=> 'no'
|
|
360
|
+
```
|
|
312
361
|
|
|
313
362
|
@example
|
|
314
363
|
```
|
|
315
|
-
import
|
|
364
|
+
import {If, IsAny, IsNever} from 'type-fest';
|
|
316
365
|
|
|
317
|
-
|
|
318
|
-
|
|
366
|
+
type A = If<IsAny<unknown>, 'is any', 'not any'>;
|
|
367
|
+
//=> 'not any'
|
|
319
368
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
369
|
+
type B = If<IsNever<never>, 'is never', 'not never'>;
|
|
370
|
+
//=> 'is never'
|
|
371
|
+
```
|
|
323
372
|
|
|
324
|
-
|
|
325
|
-
|
|
373
|
+
@example
|
|
374
|
+
```
|
|
375
|
+
import {If, IsEqual} from 'type-fest';
|
|
326
376
|
|
|
327
|
-
|
|
328
|
-
|
|
377
|
+
type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
|
|
378
|
+
|
|
379
|
+
type A = IfEqual<string, string, 'equal', 'not equal'>;
|
|
380
|
+
//=> 'equal'
|
|
381
|
+
|
|
382
|
+
type B = IfEqual<string, number, 'equal', 'not equal'>;
|
|
383
|
+
//=> 'not equal'
|
|
329
384
|
```
|
|
330
385
|
|
|
331
386
|
@category Type Guard
|
|
332
387
|
@category Utilities
|
|
333
388
|
*/
|
|
334
|
-
type
|
|
389
|
+
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever$1<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
335
390
|
//#endregion
|
|
336
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
391
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/internal/type.d.ts
|
|
392
|
+
/**
|
|
393
|
+
Matches any primitive, `void`, `Date`, or `RegExp` value.
|
|
394
|
+
*/
|
|
395
|
+
type BuiltIns = Primitive | void | Date | RegExp;
|
|
337
396
|
/**
|
|
338
|
-
|
|
397
|
+
Test if the given function has multiple call signatures.
|
|
339
398
|
|
|
340
|
-
|
|
341
|
-
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
399
|
+
Needed to handle the case of a single call signature with properties.
|
|
342
400
|
|
|
343
|
-
|
|
344
|
-
|
|
401
|
+
Multiple call signatures cannot currently be supported due to a TypeScript limitation.
|
|
402
|
+
@see https://github.com/microsoft/TypeScript/issues/29732
|
|
403
|
+
*/
|
|
404
|
+
type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
405
|
+
(...arguments_: infer A): unknown;
|
|
406
|
+
(...arguments_: infer B): unknown;
|
|
407
|
+
} ? B extends A ? A extends B ? false : true : true : false;
|
|
408
|
+
/**
|
|
409
|
+
An if-else-like type that resolves depending on whether the given type is `any` or `never`.
|
|
345
410
|
|
|
346
411
|
@example
|
|
347
412
|
```
|
|
348
|
-
|
|
413
|
+
// When `T` is a NOT `any` or `never` (like `string`) => Returns `IfNotAnyOrNever` branch
|
|
414
|
+
type A = IfNotAnyOrNever<string, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
415
|
+
//=> 'VALID'
|
|
349
416
|
|
|
350
|
-
//
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
Value extends readonly [Value[0], ...infer rest]
|
|
354
|
-
? IsEqual<Value[0], Item> extends true
|
|
355
|
-
? true
|
|
356
|
-
: Includes<rest, Item>
|
|
357
|
-
: false;
|
|
358
|
-
```
|
|
417
|
+
// When `T` is `any` => Returns `IfAny` branch
|
|
418
|
+
type B = IfNotAnyOrNever<any, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
419
|
+
//=> 'IS_ANY'
|
|
359
420
|
|
|
360
|
-
|
|
361
|
-
|
|
421
|
+
// When `T` is `never` => Returns `IfNever` branch
|
|
422
|
+
type C = IfNotAnyOrNever<never, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
423
|
+
//=> 'IS_NEVER'
|
|
424
|
+
```
|
|
362
425
|
*/
|
|
363
|
-
type
|
|
426
|
+
type IfNotAnyOrNever<T, IfNotAnyOrNever, IfAny = any, IfNever = never> = If<IsAny<T>, IfAny, If<IsNever$1<T>, IfNever, IfNotAnyOrNever>>;
|
|
364
427
|
//#endregion
|
|
365
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
428
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-null.d.ts
|
|
366
429
|
/**
|
|
367
|
-
Returns a boolean for whether
|
|
368
|
-
|
|
369
|
-
Use-case: Constructing complex conditional types where multiple conditions must be satisfied.
|
|
430
|
+
Returns a boolean for whether the given type is `null`.
|
|
370
431
|
|
|
371
432
|
@example
|
|
372
433
|
```
|
|
373
|
-
import type {
|
|
434
|
+
import type {IsNull} from 'type-fest';
|
|
374
435
|
|
|
375
|
-
|
|
376
|
-
//=> true
|
|
436
|
+
type NonNullFallback<T, Fallback> = IsNull<T> extends true ? Fallback : T;
|
|
377
437
|
|
|
378
|
-
|
|
379
|
-
//=>
|
|
438
|
+
type Example1 = NonNullFallback<null, string>;
|
|
439
|
+
//=> string
|
|
440
|
+
|
|
441
|
+
type Example2 = NonNullFallback<number, string>;
|
|
442
|
+
//=? number
|
|
380
443
|
```
|
|
381
444
|
|
|
382
|
-
@
|
|
445
|
+
@category Type Guard
|
|
446
|
+
@category Utilities
|
|
383
447
|
*/
|
|
384
|
-
type
|
|
448
|
+
type IsNull<T> = [T] extends [null] ? true : false;
|
|
385
449
|
//#endregion
|
|
386
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
450
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-unknown.d.ts
|
|
387
451
|
/**
|
|
388
|
-
|
|
389
|
-
*/
|
|
390
|
-
type RequireNone<KeysType extends PropertyKey> = Partial<Record<KeysType, never>>;
|
|
452
|
+
Returns a boolean for whether the given type is `unknown`.
|
|
391
453
|
|
|
392
|
-
|
|
393
|
-
|
|
454
|
+
@link https://github.com/dsherret/conditional-type-checks/pull/16
|
|
455
|
+
|
|
456
|
+
Useful in type utilities, such as when dealing with unknown data from API calls.
|
|
457
|
+
|
|
458
|
+
@example
|
|
459
|
+
```
|
|
460
|
+
import type {IsUnknown} from 'type-fest';
|
|
461
|
+
|
|
462
|
+
// https://github.com/pajecawav/tiny-global-store/blob/master/src/index.ts
|
|
463
|
+
type Action<TState, TPayload = void> =
|
|
464
|
+
IsUnknown<TPayload> extends true
|
|
465
|
+
? (state: TState) => TState,
|
|
466
|
+
: (state: TState, payload: TPayload) => TState;
|
|
467
|
+
|
|
468
|
+
class Store<TState> {
|
|
469
|
+
constructor(private state: TState) {}
|
|
470
|
+
|
|
471
|
+
execute<TPayload = void>(action: Action<TState, TPayload>, payload?: TPayload): TState {
|
|
472
|
+
this.state = action(this.state, payload);
|
|
473
|
+
return this.state;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// ... other methods
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
const store = new Store({value: 1});
|
|
480
|
+
declare const someExternalData: unknown;
|
|
481
|
+
|
|
482
|
+
store.execute(state => ({value: state.value + 1}));
|
|
483
|
+
//=> `TPayload` is `void`
|
|
484
|
+
|
|
485
|
+
store.execute((state, payload) => ({value: state.value + payload}), 5);
|
|
486
|
+
//=> `TPayload` is `5`
|
|
487
|
+
|
|
488
|
+
store.execute((state, payload) => ({value: state.value + payload}), someExternalData);
|
|
489
|
+
//=> Errors: `action` is `(state: TState) => TState`
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
@category Utilities
|
|
394
493
|
*/
|
|
494
|
+
type IsUnknown<T> = (unknown extends T // `T` can be `unknown` or `any`
|
|
495
|
+
? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be
|
|
496
|
+
? true : false : false);
|
|
395
497
|
//#endregion
|
|
396
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
498
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/simplify.d.ts
|
|
397
499
|
/**
|
|
398
500
|
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.
|
|
399
501
|
|
|
@@ -453,7 +555,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
453
555
|
*/
|
|
454
556
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
455
557
|
//#endregion
|
|
456
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
558
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
457
559
|
/**
|
|
458
560
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
459
561
|
|
|
@@ -546,7 +648,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
546
648
|
*/
|
|
547
649
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
|
|
548
650
|
//#endregion
|
|
549
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
651
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
550
652
|
/**
|
|
551
653
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
552
654
|
|
|
@@ -594,7 +696,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
594
696
|
*/
|
|
595
697
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
|
|
596
698
|
//#endregion
|
|
597
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
699
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/merge.d.ts
|
|
598
700
|
// Merges two objects without worrying about index signatures.
|
|
599
701
|
type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
|
|
600
702
|
|
|
@@ -634,101 +736,7 @@ export type FooBar = Merge<Foo, Bar>;
|
|
|
634
736
|
*/
|
|
635
737
|
type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
636
738
|
//#endregion
|
|
637
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
638
|
-
/**
|
|
639
|
-
An if-else-like type that resolves depending on whether the given type is `any`.
|
|
640
|
-
|
|
641
|
-
@see {@link IsAny}
|
|
642
|
-
|
|
643
|
-
@example
|
|
644
|
-
```
|
|
645
|
-
import type {IfAny} from 'type-fest';
|
|
646
|
-
|
|
647
|
-
type ShouldBeTrue = IfAny<any>;
|
|
648
|
-
//=> true
|
|
649
|
-
|
|
650
|
-
type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
|
|
651
|
-
//=> 'bar'
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
@category Type Guard
|
|
655
|
-
@category Utilities
|
|
656
|
-
*/
|
|
657
|
-
type IfAny$1<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
|
|
658
|
-
//#endregion
|
|
659
|
-
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/type.d.ts
|
|
660
|
-
/**
|
|
661
|
-
Matches any primitive, `void`, `Date`, or `RegExp` value.
|
|
662
|
-
*/
|
|
663
|
-
type BuiltIns = Primitive | void | Date | RegExp;
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
Matches non-recursive types.
|
|
667
|
-
*/
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
Test if the given function has multiple call signatures.
|
|
671
|
-
|
|
672
|
-
Needed to handle the case of a single call signature with properties.
|
|
673
|
-
|
|
674
|
-
Multiple call signatures cannot currently be supported due to a TypeScript limitation.
|
|
675
|
-
@see https://github.com/microsoft/TypeScript/issues/29732
|
|
676
|
-
*/
|
|
677
|
-
type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
678
|
-
(...arguments_: infer A): unknown;
|
|
679
|
-
(...arguments_: infer B): unknown;
|
|
680
|
-
} ? B extends A ? A extends B ? false : true : true : false;
|
|
681
|
-
|
|
682
|
-
/**
|
|
683
|
-
Returns a boolean for whether the given `boolean` is not `false`.
|
|
684
|
-
*/
|
|
685
|
-
|
|
686
|
-
/**
|
|
687
|
-
Returns a boolean for whether the given type is a union type.
|
|
688
|
-
|
|
689
|
-
@example
|
|
690
|
-
```
|
|
691
|
-
type A = IsUnion<string | number>;
|
|
692
|
-
//=> true
|
|
693
|
-
|
|
694
|
-
type B = IsUnion<string>;
|
|
695
|
-
//=> false
|
|
696
|
-
```
|
|
697
|
-
*/
|
|
698
|
-
type IsUnion$1<T> = InternalIsUnion<T>;
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
The actual implementation of `IsUnion`.
|
|
702
|
-
*/
|
|
703
|
-
type InternalIsUnion<T, U = T> = (
|
|
704
|
-
// @link https://ghaiklor.github.io/type-challenges-solutions/en/medium-isunion.html
|
|
705
|
-
IsNever$1<T> extends true ? false : T extends any ? [U] extends [T] ? false : true : never) extends infer Result
|
|
706
|
-
// In some cases `Result` will return `false | true` which is `boolean`,
|
|
707
|
-
// that means `T` has at least two types and it's a union type,
|
|
708
|
-
// so we will return `true` instead of `boolean`.
|
|
709
|
-
? boolean extends Result ? true : Result : never; // Should never happen
|
|
710
|
-
|
|
711
|
-
/**
|
|
712
|
-
An if-else-like type that resolves depending on whether the given type is `any` or `never`.
|
|
713
|
-
|
|
714
|
-
@example
|
|
715
|
-
```
|
|
716
|
-
// When `T` is a NOT `any` or `never` (like `string`) => Returns `IfNotAnyOrNever` branch
|
|
717
|
-
type A = IfNotAnyOrNever<string, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
718
|
-
//=> 'VALID'
|
|
719
|
-
|
|
720
|
-
// When `T` is `any` => Returns `IfAny` branch
|
|
721
|
-
type B = IfNotAnyOrNever<any, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
722
|
-
//=> 'IS_ANY'
|
|
723
|
-
|
|
724
|
-
// When `T` is `never` => Returns `IfNever` branch
|
|
725
|
-
type C = IfNotAnyOrNever<never, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
726
|
-
//=> 'IS_NEVER'
|
|
727
|
-
```
|
|
728
|
-
*/
|
|
729
|
-
type IfNotAnyOrNever<T, IfNotAnyOrNever, IfAny = any, IfNever = never> = IsAny<T> extends true ? IfAny : IsNever$1<T> extends true ? IfNever : IfNotAnyOrNever;
|
|
730
|
-
//#endregion
|
|
731
|
-
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
|
|
739
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/internal/object.d.ts
|
|
732
740
|
/**
|
|
733
741
|
Merges user specified options with default options.
|
|
734
742
|
|
|
@@ -781,10 +789,95 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
781
789
|
// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
|
|
782
790
|
```
|
|
783
791
|
*/
|
|
784
|
-
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> =
|
|
785
|
-
>>;
|
|
792
|
+
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever$1<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
|
|
786
793
|
//#endregion
|
|
787
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
794
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/or.d.ts
|
|
795
|
+
/**
|
|
796
|
+
Returns a boolean for whether either of two given types are true.
|
|
797
|
+
|
|
798
|
+
Use-case: Constructing complex conditional types where multiple conditions must be satisfied.
|
|
799
|
+
|
|
800
|
+
@example
|
|
801
|
+
```
|
|
802
|
+
import type {Or} from 'type-fest';
|
|
803
|
+
|
|
804
|
+
type TT = Or<true, false>;
|
|
805
|
+
//=> true
|
|
806
|
+
|
|
807
|
+
type TF = Or<true, false>;
|
|
808
|
+
//=> true
|
|
809
|
+
|
|
810
|
+
type FT = Or<false, true>;
|
|
811
|
+
//=> true
|
|
812
|
+
|
|
813
|
+
type FF = Or<false, false>;
|
|
814
|
+
//=> false
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
Note: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.
|
|
818
|
+
For example, `And<false, boolean>` expands to `And<false, true> | And<false, false>`, which simplifies to `true | false` (i.e., `boolean`).
|
|
819
|
+
@example
|
|
820
|
+
```
|
|
821
|
+
import type {And} from 'type-fest';
|
|
822
|
+
|
|
823
|
+
type A = Or<false, boolean>;
|
|
824
|
+
//=> boolean
|
|
825
|
+
|
|
826
|
+
type B = Or<boolean, false>;
|
|
827
|
+
//=> boolean
|
|
828
|
+
|
|
829
|
+
type C = Or<true, boolean>;
|
|
830
|
+
//=> true
|
|
831
|
+
|
|
832
|
+
type D = Or<boolean, true>;
|
|
833
|
+
//=> true
|
|
834
|
+
|
|
835
|
+
type E = Or<boolean, boolean>;
|
|
836
|
+
//=> boolean
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
Note: If `never` is passed as an argument, it is treated as `false` and the result is computed accordingly.
|
|
840
|
+
|
|
841
|
+
@example
|
|
842
|
+
```
|
|
843
|
+
import type {Or} from 'type-fest';
|
|
844
|
+
|
|
845
|
+
type A = Or<true, never>;
|
|
846
|
+
//=> true
|
|
847
|
+
|
|
848
|
+
type B = Or<never, true>;
|
|
849
|
+
//=> true
|
|
850
|
+
|
|
851
|
+
type C = Or<false, never>;
|
|
852
|
+
//=> false
|
|
853
|
+
|
|
854
|
+
type D = Or<never, false>;
|
|
855
|
+
//=> false
|
|
856
|
+
|
|
857
|
+
type E = Or<boolean, never>;
|
|
858
|
+
//=> boolean
|
|
859
|
+
|
|
860
|
+
type F = Or<never, boolean>;
|
|
861
|
+
//=> boolean
|
|
862
|
+
|
|
863
|
+
type G = Or<never, never>;
|
|
864
|
+
//=> false
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
@see {@link And}
|
|
868
|
+
*/
|
|
869
|
+
type Or<A extends boolean, B extends boolean> = _Or<If<IsNever$1<A>, false, A>, If<IsNever$1<B>, false, B>>;
|
|
870
|
+
// `never` is treated as `false`
|
|
871
|
+
|
|
872
|
+
type _Or<A extends boolean, B extends boolean> = A extends true ? true : B extends true ? true : false;
|
|
873
|
+
//#endregion
|
|
874
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/internal/keys.d.ts
|
|
875
|
+
/**
|
|
876
|
+
Disallows any of the given keys.
|
|
877
|
+
*/
|
|
878
|
+
type RequireNone<KeysType extends PropertyKey> = Partial<Record<KeysType, never>>;
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/require-exactly-one.d.ts
|
|
788
881
|
/**
|
|
789
882
|
Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is.
|
|
790
883
|
|
|
@@ -814,10 +907,10 @@ const responder: RequireExactlyOne<Responder, 'text' | 'json'> = {
|
|
|
814
907
|
|
|
815
908
|
@category Object
|
|
816
909
|
*/
|
|
817
|
-
type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType,
|
|
910
|
+
type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, If<IsNever$1<KeysType>, never, _RequireExactlyOne<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>>>;
|
|
818
911
|
type _RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType> = { [Key in KeysType]: (Required<Pick<ObjectType, Key>> & Partial<Record<Exclude<KeysType, Key>, never>>) }[KeysType] & Omit<ObjectType, KeysType>;
|
|
819
912
|
//#endregion
|
|
820
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
913
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/require-one-or-none.d.ts
|
|
821
914
|
/**
|
|
822
915
|
Create a type that requires exactly one of the given keys and disallows more, or none of the given keys. The remaining keys are kept as is.
|
|
823
916
|
|
|
@@ -848,10 +941,35 @@ const responder3: Responder = {
|
|
|
848
941
|
|
|
849
942
|
@category Object
|
|
850
943
|
*/
|
|
851
|
-
type RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType,
|
|
944
|
+
type RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, If<IsNever$1<KeysType>, ObjectType, _RequireOneOrNone<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>>>;
|
|
852
945
|
type _RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType> = (RequireExactlyOne<ObjectType, KeysType> | RequireNone<KeysType>) & Omit<ObjectType, KeysType>; // Ignore unspecified keys.
|
|
853
946
|
//#endregion
|
|
854
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
947
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-union.d.ts
|
|
948
|
+
/**
|
|
949
|
+
Returns a boolean for whether the given type is a union.
|
|
950
|
+
|
|
951
|
+
@example
|
|
952
|
+
```
|
|
953
|
+
import type {IsUnion} from 'type-fest';
|
|
954
|
+
|
|
955
|
+
type A = IsUnion<string | number>;
|
|
956
|
+
//=> true
|
|
957
|
+
|
|
958
|
+
type B = IsUnion<string>;
|
|
959
|
+
//=> false
|
|
960
|
+
```
|
|
961
|
+
*/
|
|
962
|
+
type IsUnion$1<T> = InternalIsUnion<T>;
|
|
963
|
+
/**
|
|
964
|
+
The actual implementation of `IsUnion`.
|
|
965
|
+
*/
|
|
966
|
+
type InternalIsUnion<T, U = T> = (IsNever$1<T> extends true ? false : T extends any ? [U] extends [T] ? false : true : never) extends infer Result
|
|
967
|
+
// In some cases `Result` will return `false | true` which is `boolean`,
|
|
968
|
+
// that means `T` has at least two types and it's a union type,
|
|
969
|
+
// so we will return `true` instead of `boolean`.
|
|
970
|
+
? boolean extends Result ? true : Result : never; // Should never happen
|
|
971
|
+
//#endregion
|
|
972
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/partial-deep.d.ts
|
|
855
973
|
/**
|
|
856
974
|
@see {@link PartialDeep}
|
|
857
975
|
*/
|
|
@@ -866,24 +984,23 @@ type PartialDeepOptions = {
|
|
|
866
984
|
Allows `undefined` values in non-tuple arrays.
|
|
867
985
|
- When set to `true`, elements of non-tuple arrays can be `undefined`.
|
|
868
986
|
- When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
|
|
869
|
-
@default
|
|
987
|
+
@default false
|
|
870
988
|
@example
|
|
871
|
-
You can
|
|
989
|
+
You can allow `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}` as the second type argument:
|
|
872
990
|
```
|
|
873
991
|
import type {PartialDeep} from 'type-fest';
|
|
874
992
|
type Settings = {
|
|
875
993
|
languages: string[];
|
|
876
994
|
};
|
|
877
|
-
declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays:
|
|
878
|
-
partialSettings.languages = [undefined]; //
|
|
879
|
-
partialSettings.languages = []; // Ok
|
|
995
|
+
declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}>;
|
|
996
|
+
partialSettings.languages = [undefined]; // OK
|
|
880
997
|
```
|
|
881
998
|
*/
|
|
882
999
|
readonly allowUndefinedInNonTupleArrays?: boolean;
|
|
883
1000
|
};
|
|
884
1001
|
type DefaultPartialDeepOptions = {
|
|
885
1002
|
recurseIntoArrays: false;
|
|
886
|
-
allowUndefinedInNonTupleArrays:
|
|
1003
|
+
allowUndefinedInNonTupleArrays: false;
|
|
887
1004
|
};
|
|
888
1005
|
|
|
889
1006
|
/**
|
|
@@ -897,19 +1014,19 @@ Use-cases:
|
|
|
897
1014
|
```
|
|
898
1015
|
import type {PartialDeep} from 'type-fest';
|
|
899
1016
|
|
|
900
|
-
|
|
1017
|
+
let settings = {
|
|
901
1018
|
textEditor: {
|
|
902
1019
|
fontSize: 14,
|
|
903
1020
|
fontColor: '#000000',
|
|
904
|
-
fontWeight: 400
|
|
1021
|
+
fontWeight: 400,
|
|
905
1022
|
},
|
|
906
1023
|
autocomplete: false,
|
|
907
|
-
autosave: true
|
|
1024
|
+
autosave: true,
|
|
908
1025
|
};
|
|
909
1026
|
|
|
910
|
-
const applySavedSettings = (savedSettings: PartialDeep<
|
|
911
|
-
|
|
912
|
-
|
|
1027
|
+
const applySavedSettings = (savedSettings: PartialDeep<typeof settings>) => (
|
|
1028
|
+
{...settings, ...savedSettings, textEditor: {...settings.textEditor, ...savedSettings.textEditor}}
|
|
1029
|
+
);
|
|
913
1030
|
|
|
914
1031
|
settings = applySavedSettings({textEditor: {fontWeight: 500}});
|
|
915
1032
|
```
|
|
@@ -919,13 +1036,15 @@ By default, this does not affect elements in array and tuple types. You can chan
|
|
|
919
1036
|
```
|
|
920
1037
|
import type {PartialDeep} from 'type-fest';
|
|
921
1038
|
|
|
922
|
-
type
|
|
923
|
-
|
|
924
|
-
}
|
|
1039
|
+
type Shape = {
|
|
1040
|
+
dimensions: [number, number];
|
|
1041
|
+
};
|
|
925
1042
|
|
|
926
|
-
const
|
|
927
|
-
|
|
1043
|
+
const partialShape: PartialDeep<Shape, {recurseIntoArrays: true}> = {
|
|
1044
|
+
dimensions: [], // OK
|
|
928
1045
|
};
|
|
1046
|
+
|
|
1047
|
+
partialShape.dimensions = [15]; // OK
|
|
929
1048
|
```
|
|
930
1049
|
|
|
931
1050
|
@see {@link PartialDeepOptions}
|
|
@@ -969,9 +1088,7 @@ Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for
|
|
|
969
1088
|
*/
|
|
970
1089
|
type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = (ObjectType extends ((...arguments_: any) => unknown) ? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType> : {}) & ({ [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> });
|
|
971
1090
|
//#endregion
|
|
972
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
973
|
-
type ExcludeUndefined<T> = Exclude<T, undefined>;
|
|
974
|
-
|
|
1091
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/required-deep.d.ts
|
|
975
1092
|
/**
|
|
976
1093
|
Create a type from another type with all keys and nested keys set to required.
|
|
977
1094
|
|
|
@@ -985,23 +1102,23 @@ import type {RequiredDeep} from 'type-fest';
|
|
|
985
1102
|
|
|
986
1103
|
type Settings = {
|
|
987
1104
|
textEditor?: {
|
|
988
|
-
fontSize?: number
|
|
989
|
-
fontColor?: string
|
|
1105
|
+
fontSize?: number;
|
|
1106
|
+
fontColor?: string;
|
|
990
1107
|
fontWeight?: number | undefined;
|
|
991
|
-
}
|
|
992
|
-
autocomplete?: boolean
|
|
1108
|
+
};
|
|
1109
|
+
autocomplete?: boolean;
|
|
993
1110
|
autosave?: boolean | undefined;
|
|
994
1111
|
};
|
|
995
1112
|
|
|
996
1113
|
type RequiredSettings = RequiredDeep<Settings>;
|
|
997
|
-
|
|
1114
|
+
//=> {
|
|
998
1115
|
// textEditor: {
|
|
999
1116
|
// fontSize: number;
|
|
1000
1117
|
// fontColor: string;
|
|
1001
|
-
// fontWeight: number;
|
|
1002
|
-
// }
|
|
1118
|
+
// fontWeight: number | undefined;
|
|
1119
|
+
// };
|
|
1003
1120
|
// autocomplete: boolean;
|
|
1004
|
-
// autosave: boolean;
|
|
1121
|
+
// autosave: boolean | undefined;
|
|
1005
1122
|
// }
|
|
1006
1123
|
```
|
|
1007
1124
|
|
|
@@ -1013,14 +1130,10 @@ Note that types containing overloaded functions are not made deeply required due
|
|
|
1013
1130
|
@category Set
|
|
1014
1131
|
@category Map
|
|
1015
1132
|
*/
|
|
1016
|
-
type RequiredDeep<T
|
|
1017
|
-
? ItemType[] extends E // Test for arrays (non-tuples) specifically
|
|
1018
|
-
? Array<RequiredDeep<ItemType>> // Recreate relevant array type to prevent eager evaluation of circular reference
|
|
1019
|
-
: RequiredObjectDeep<E> // Tuples behave properly
|
|
1020
|
-
: RequiredObjectDeep<E> : unknown;
|
|
1133
|
+
type RequiredDeep<T> = T extends BuiltIns ? T : T extends Map<infer KeyType, infer ValueType> ? Map<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T extends Set<infer ItemType> ? Set<RequiredDeep<ItemType>> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T extends ReadonlySet<infer ItemType> ? ReadonlySet<RequiredDeep<ItemType>> : T extends WeakMap<infer KeyType, infer ValueType> ? WeakMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T extends WeakSet<infer ItemType> ? WeakSet<RequiredDeep<ItemType>> : T extends Promise<infer ValueType> ? Promise<RequiredDeep<ValueType>> : T extends ((...arguments_: any[]) => unknown) ? {} extends RequiredObjectDeep<T> ? T : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & RequiredObjectDeep<T> : T extends object ? RequiredObjectDeep<T> : unknown;
|
|
1021
1134
|
type RequiredObjectDeep<ObjectType extends object> = { [KeyType in keyof ObjectType]-?: RequiredDeep<ObjectType[KeyType]> };
|
|
1022
1135
|
//#endregion
|
|
1023
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
1136
|
+
//#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/union-to-tuple.d.ts
|
|
1024
1137
|
/**
|
|
1025
1138
|
Returns the last element of a union type.
|
|
1026
1139
|
|
|
@@ -1069,76 +1182,6 @@ const petList = Object.keys(pets) as UnionToTuple<Pet>;
|
|
|
1069
1182
|
*/
|
|
1070
1183
|
type UnionToTuple<T, L = LastOfUnion<T>> = IsNever$1<T> extends false ? [...UnionToTuple<Exclude<T, L>>, L] : [];
|
|
1071
1184
|
//#endregion
|
|
1072
|
-
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-null.d.ts
|
|
1073
|
-
/**
|
|
1074
|
-
Returns a boolean for whether the given type is `null`.
|
|
1075
|
-
|
|
1076
|
-
@example
|
|
1077
|
-
```
|
|
1078
|
-
import type {IsNull} from 'type-fest';
|
|
1079
|
-
|
|
1080
|
-
type NonNullFallback<T, Fallback> = IsNull<T> extends true ? Fallback : T;
|
|
1081
|
-
|
|
1082
|
-
type Example1 = NonNullFallback<null, string>;
|
|
1083
|
-
//=> string
|
|
1084
|
-
|
|
1085
|
-
type Example2 = NonNullFallback<number, string>;
|
|
1086
|
-
//=? number
|
|
1087
|
-
```
|
|
1088
|
-
|
|
1089
|
-
@category Type Guard
|
|
1090
|
-
@category Utilities
|
|
1091
|
-
*/
|
|
1092
|
-
type IsNull<T> = [T] extends [null] ? true : false;
|
|
1093
|
-
//#endregion
|
|
1094
|
-
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-unknown.d.ts
|
|
1095
|
-
/**
|
|
1096
|
-
Returns a boolean for whether the given type is `unknown`.
|
|
1097
|
-
|
|
1098
|
-
@link https://github.com/dsherret/conditional-type-checks/pull/16
|
|
1099
|
-
|
|
1100
|
-
Useful in type utilities, such as when dealing with unknown data from API calls.
|
|
1101
|
-
|
|
1102
|
-
@example
|
|
1103
|
-
```
|
|
1104
|
-
import type {IsUnknown} from 'type-fest';
|
|
1105
|
-
|
|
1106
|
-
// https://github.com/pajecawav/tiny-global-store/blob/master/src/index.ts
|
|
1107
|
-
type Action<TState, TPayload = void> =
|
|
1108
|
-
IsUnknown<TPayload> extends true
|
|
1109
|
-
? (state: TState) => TState,
|
|
1110
|
-
: (state: TState, payload: TPayload) => TState;
|
|
1111
|
-
|
|
1112
|
-
class Store<TState> {
|
|
1113
|
-
constructor(private state: TState) {}
|
|
1114
|
-
|
|
1115
|
-
execute<TPayload = void>(action: Action<TState, TPayload>, payload?: TPayload): TState {
|
|
1116
|
-
this.state = action(this.state, payload);
|
|
1117
|
-
return this.state;
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
// ... other methods
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
const store = new Store({value: 1});
|
|
1124
|
-
declare const someExternalData: unknown;
|
|
1125
|
-
|
|
1126
|
-
store.execute(state => ({value: state.value + 1}));
|
|
1127
|
-
//=> `TPayload` is `void`
|
|
1128
|
-
|
|
1129
|
-
store.execute((state, payload) => ({value: state.value + payload}), 5);
|
|
1130
|
-
//=> `TPayload` is `5`
|
|
1131
|
-
|
|
1132
|
-
store.execute((state, payload) => ({value: state.value + payload}), someExternalData);
|
|
1133
|
-
//=> Errors: `action` is `(state: TState) => TState`
|
|
1134
|
-
```
|
|
1135
|
-
|
|
1136
|
-
@category Utilities
|
|
1137
|
-
*/
|
|
1138
|
-
type IsUnknown<T> = (unknown extends T // `T` can be `unknown` or `any`
|
|
1139
|
-
? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be
|
|
1140
|
-
? true : false : false);
|
|
1141
|
-
//#endregion
|
|
1142
1185
|
//#region src/types/core/modifiers.types.d.ts
|
|
1143
1186
|
interface RegleBehaviourOptions {
|
|
1144
1187
|
/**
|
|
@@ -1208,7 +1251,7 @@ type CollectionRegleBehaviourOptions = FieldRegleBehaviourOptions & {
|
|
|
1208
1251
|
};
|
|
1209
1252
|
type ResolvedRegleBehaviourOptions = DeepMaybeRef<RequiredDeep<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Record<string, any>, Record<string, any>, Record<string, any[]>>;
|
|
1210
1253
|
type ShortcutCommonFn<T extends Record<string, any>> = {
|
|
1211
|
-
[x: string]: (element: OmitByType<T, Function>) => unknown;
|
|
1254
|
+
[x: string]: (element: Omit<OmitByType<T, Function>, '~standard'>) => unknown;
|
|
1212
1255
|
};
|
|
1213
1256
|
type RegleShortcutDefinition<TCustomRules extends Record<string, any> = {}> = {
|
|
1214
1257
|
/**
|
|
@@ -1308,6 +1351,28 @@ type RegleResult<Data extends Record<string, any> | any[] | unknown, TRules exte
|
|
|
1308
1351
|
valid: true;
|
|
1309
1352
|
data: IsUnknown<Data> extends true ? unknown : IsAny<Data> extends true ? unknown : HasNamedKeys<Data> extends true ? Data extends Array<infer U extends Record<string, any>> ? DeepSafeFormState<U, TRules>[] : Data extends Date | File ? SafeFieldProperty<Data, TRules> : Data extends Record<string, any> ? DeepSafeFormState<Data, TRules> : SafeFieldProperty<Data, TRules> : unknown;
|
|
1310
1353
|
};
|
|
1354
|
+
type RegleNestedResult<Data extends Record<string, any> | unknown, TRules extends ReglePartialRuleTree<any> | RegleFormPropertyType<any>> = RegleResult<Data, TRules> & ({
|
|
1355
|
+
valid: false;
|
|
1356
|
+
issues: RegleIssuesTree<Data>;
|
|
1357
|
+
errors: RegleErrorTree<Data>;
|
|
1358
|
+
} | {
|
|
1359
|
+
valid: true;
|
|
1360
|
+
issues: EmptyObject;
|
|
1361
|
+
errors: EmptyObject;
|
|
1362
|
+
});
|
|
1363
|
+
type RegleCollectionResult<Data extends any[], TRules extends ReglePartialRuleTree<any> | RegleFormPropertyType<any>> = RegleResult<Data, TRules> & ({
|
|
1364
|
+
valid: false;
|
|
1365
|
+
issues: RegleCollectionErrors<Data, true>;
|
|
1366
|
+
errors: RegleCollectionErrors<Data>;
|
|
1367
|
+
} | {
|
|
1368
|
+
valid: true;
|
|
1369
|
+
issues: EmptyObject;
|
|
1370
|
+
errors: EmptyObject;
|
|
1371
|
+
});
|
|
1372
|
+
type RegleFieldResult<Data extends any, TRules extends ReglePartialRuleTree<any> | RegleFormPropertyType<any>> = RegleResult<Data, TRules> & {
|
|
1373
|
+
issues: RegleFieldIssue<TRules>[];
|
|
1374
|
+
errors: string[];
|
|
1375
|
+
};
|
|
1311
1376
|
/**
|
|
1312
1377
|
* Infer safe output from any `r$` instance
|
|
1313
1378
|
*
|
|
@@ -1319,6 +1384,8 @@ type InferSafeOutput<TRegle extends MaybeRef<RegleRoot<{}, any, any, any>> | May
|
|
|
1319
1384
|
type $InternalRegleResult = {
|
|
1320
1385
|
valid: boolean;
|
|
1321
1386
|
data: any;
|
|
1387
|
+
errors: $InternalRegleErrorTree | $InternalRegleCollectionErrors | string[];
|
|
1388
|
+
issues: $InternalRegleIssuesTree | $InternalRegleCollectionIssues | RegleFieldIssue[];
|
|
1322
1389
|
};
|
|
1323
1390
|
type DeepSafeFormState<TState extends Record<string, any>, TRules extends ReglePartialRuleTree<Record<string, any>, CustomRulesDeclarationTree> | RegleFormPropertyType<any, any> | undefined> = [unknown] extends [TState] ? {} : TRules extends undefined ? TState : TRules extends ReglePartialRuleTree<TState, CustomRulesDeclarationTree> ? Prettify<{ [K in keyof TState as IsPropertyOutputRequired<TState[K], TRules[K]> extends false ? K : never]?: SafeProperty<TState[K], TRules[K]> extends MaybeInput<infer M> ? MaybeOutput<M> : SafeProperty<TState[K], TRules[K]> } & { [K in keyof TState as IsPropertyOutputRequired<TState[K], TRules[K]> extends false ? never : K]-?: unknown extends SafeProperty<TState[K], TRules[K]> ? unknown : NonNullable<SafeProperty<TState[K], TRules[K]>> }> : TState;
|
|
1324
1391
|
type FieldHaveRequiredRule<TRule extends RegleFormPropertyType<any, any> | undefined = never> = TRule extends MaybeRef<RegleRuleDecl<any, any>> ? [unknown] extends UnwrapRef<TRule>['required'] ? NonNullable<UnwrapRef<TRule>['literal']> extends RegleRuleDefinition<any, any[], any, any, any, any> ? true : false : NonNullable<UnwrapRef<TRule>['required']> extends UnwrapRef<TRule>['required'] ? UnwrapRef<TRule>['required'] extends RegleRuleDefinition<any, infer Params, any, any, any, any> ? Params extends never[] ? true : false : false : false : false;
|
|
@@ -1333,30 +1400,16 @@ type SafeFieldProperty<TState, TRule extends RegleFormPropertyType<any, any> | u
|
|
|
1333
1400
|
* Negates a boolean type.
|
|
1334
1401
|
*/
|
|
1335
1402
|
type Not<T extends boolean> = T extends true ? false : true;
|
|
1336
|
-
/**
|
|
1337
|
-
* Returns `true` if at least one of the types in the
|
|
1338
|
-
* {@linkcode Types} array is `true`, otherwise returns `false`.
|
|
1339
|
-
*/
|
|
1340
|
-
|
|
1341
1403
|
/**
|
|
1342
1404
|
* Checks if the given type is `never`.
|
|
1343
1405
|
*/
|
|
1344
1406
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
1345
|
-
/**
|
|
1346
|
-
* Checks if the given type is `any`.
|
|
1347
|
-
*/
|
|
1348
|
-
|
|
1349
1407
|
/**
|
|
1350
1408
|
* Checks if one type extends another. Note: this is not quite the same as `Left extends Right` because:
|
|
1351
1409
|
* 1. If either type is `never`, the result is `true` iff the other type is also `never`.
|
|
1352
1410
|
* 2. Types are wrapped in a 1-tuple so that union types are not distributed - instead we consider `string | number` to _not_ extend `number`. If we used `Left extends Right` directly you would get `Extends<string | number, number>` => `false | true` => `boolean`.
|
|
1353
1411
|
*/
|
|
1354
1412
|
type Extends<Left, Right> = IsNever<Left> extends true ? IsNever<Right> : [Left] extends [Right] ? true : false;
|
|
1355
|
-
/**
|
|
1356
|
-
* Checks if the {@linkcode Left} type extends the {@linkcode Right} type,
|
|
1357
|
-
* excluding `any` or `never`.
|
|
1358
|
-
*/
|
|
1359
|
-
|
|
1360
1413
|
/**
|
|
1361
1414
|
* Convert a union to an intersection.
|
|
1362
1415
|
* `A | B | C` -\> `A & B & C`
|
|
@@ -1379,17 +1432,6 @@ type TuplifyUnion<Union, LastElement = LastOf<Union>> = IsNever<Union> extends t
|
|
|
1379
1432
|
*/
|
|
1380
1433
|
type UnionToTuple$1<Union> = TuplifyUnion<Union>;
|
|
1381
1434
|
type IsUnion<T> = Not<Extends<UnionToTuple$1<T>['length'], 1>>;
|
|
1382
|
-
/**
|
|
1383
|
-
* A recursive version of `Pick` that selects properties from the left type that are present in the right type.
|
|
1384
|
-
* The "leaf" types from `Left` are used - only the keys of `Right` are considered.
|
|
1385
|
-
*
|
|
1386
|
-
* @example
|
|
1387
|
-
* ```ts
|
|
1388
|
-
* const user = {email: 'a@b.com', name: 'John Doe', address: {street: '123 2nd St', city: 'New York', zip: '10001', state: 'NY', country: 'USA'}}
|
|
1389
|
-
*
|
|
1390
|
-
* type Result = DeepPickMatchingProps<typeof user, {name: unknown; address: {city: unknown}}> // {name: string, address: {city: string}}
|
|
1391
|
-
* ```
|
|
1392
|
-
*/
|
|
1393
1435
|
//#endregion
|
|
1394
1436
|
//#region src/types/core/variants.types.d.ts
|
|
1395
1437
|
type NarrowVariant<TRoot extends {
|
|
@@ -1483,6 +1525,64 @@ declare function useRootStorage({
|
|
|
1483
1525
|
regle: $InternalRegleStatusType | undefined;
|
|
1484
1526
|
};
|
|
1485
1527
|
//#endregion
|
|
1528
|
+
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.0.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
1529
|
+
/** The Standard Schema interface. */
|
|
1530
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
1531
|
+
/** The Standard Schema properties. */
|
|
1532
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
1533
|
+
}
|
|
1534
|
+
declare namespace StandardSchemaV1 {
|
|
1535
|
+
/** The Standard Schema properties interface. */
|
|
1536
|
+
export interface Props<Input = unknown, Output = Input> {
|
|
1537
|
+
/** The version number of the standard. */
|
|
1538
|
+
readonly version: 1;
|
|
1539
|
+
/** The vendor name of the schema library. */
|
|
1540
|
+
readonly vendor: string;
|
|
1541
|
+
/** Validates unknown input values. */
|
|
1542
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
1543
|
+
/** Inferred types associated with the schema. */
|
|
1544
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
1545
|
+
}
|
|
1546
|
+
/** The result interface of the validate function. */
|
|
1547
|
+
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
1548
|
+
/** The result interface if validation succeeds. */
|
|
1549
|
+
export interface SuccessResult<Output> {
|
|
1550
|
+
/** The typed output value. */
|
|
1551
|
+
readonly value: Output;
|
|
1552
|
+
/** The non-existent issues. */
|
|
1553
|
+
readonly issues?: undefined;
|
|
1554
|
+
}
|
|
1555
|
+
/** The result interface if validation fails. */
|
|
1556
|
+
export interface FailureResult {
|
|
1557
|
+
/** The issues of failed validation. */
|
|
1558
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
1559
|
+
}
|
|
1560
|
+
/** The issue interface of the failure output. */
|
|
1561
|
+
export interface Issue {
|
|
1562
|
+
/** The error message of the issue. */
|
|
1563
|
+
readonly message: string;
|
|
1564
|
+
/** The path of the issue, if any. */
|
|
1565
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
1566
|
+
}
|
|
1567
|
+
/** The path segment interface of the issue. */
|
|
1568
|
+
export interface PathSegment {
|
|
1569
|
+
/** The key representing a path segment. */
|
|
1570
|
+
readonly key: PropertyKey;
|
|
1571
|
+
}
|
|
1572
|
+
/** The Standard Schema types interface. */
|
|
1573
|
+
export interface Types<Input = unknown, Output = Input> {
|
|
1574
|
+
/** The input type of the schema. */
|
|
1575
|
+
readonly input: Input;
|
|
1576
|
+
/** The output type of the schema. */
|
|
1577
|
+
readonly output: Output;
|
|
1578
|
+
}
|
|
1579
|
+
/** Infers the input type of a Standard Schema. */
|
|
1580
|
+
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
1581
|
+
/** Infers the output type of a Standard Schema. */
|
|
1582
|
+
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
1583
|
+
export {};
|
|
1584
|
+
}
|
|
1585
|
+
//#endregion
|
|
1486
1586
|
//#region src/core/useRegle/useErrors.d.ts
|
|
1487
1587
|
/**
|
|
1488
1588
|
* Converts a nested $errors object to a flat array of string errors
|
|
@@ -1491,14 +1591,40 @@ declare function useRootStorage({
|
|
|
1491
1591
|
*/
|
|
1492
1592
|
declare function flatErrors(errors: $InternalRegleErrors, options: {
|
|
1493
1593
|
includePath: true;
|
|
1494
|
-
}):
|
|
1495
|
-
error: string;
|
|
1496
|
-
path: string;
|
|
1497
|
-
}[];
|
|
1594
|
+
}): StandardSchemaV1.Issue[];
|
|
1498
1595
|
declare function flatErrors(errors: $InternalRegleErrors, options?: {
|
|
1499
1596
|
includePath?: false;
|
|
1500
1597
|
}): string[];
|
|
1501
1598
|
//#endregion
|
|
1599
|
+
//#region src/core/useRegle/useRules.d.ts
|
|
1600
|
+
type useRulesFnOptions<TRules extends RegleUnknownRulesTree | RegleRuleDecl, TValidationGroups extends Record<string, RegleValidationGroupEntry[]>, TState = InferInput<TRules>> = Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<JoinDiscriminatedUnions<TState extends Record<string, any> ? Unwrap<TState> : {}>, TState extends Record<string, any> ? (TRules extends Record<string, any> ? TRules : {}) : {}, TValidationGroups>;
|
|
1601
|
+
interface useRulesFn<TCustomRules extends Partial<AllRulesDeclarations>, TShortcuts extends RegleShortcutDefinition<any> = never> {
|
|
1602
|
+
<TRules extends RegleUnknownRulesTree | RegleRuleDecl, TDecl extends RegleRuleDecl<NonNullable<TState>, Partial<AllRulesDeclarations> & TCustomRules>, TValidationGroups extends Record<string, RegleValidationGroupEntry[]>, TState extends Record<string, any> = InferInput<TRules>>(rulesFactory: TState extends Record<string, any> ? MaybeRef<TRules> | ((...args: any[]) => TRules) : {}, options?: useRulesFnOptions<TRules, TValidationGroups, TState>): NonNullable<TState> extends PrimitiveTypes ? Raw<RegleFieldStatus<NonNullable<TState>, TDecl, TShortcuts>> & StandardSchemaV1<TState> : Raw<RegleRoot<TState extends Record<string, any> ? Unwrap<TState> : {}, TRules extends Record<string, any> ? TRules : {}, TValidationGroups, TShortcuts>> & StandardSchemaV1<TState>;
|
|
1603
|
+
__config?: {
|
|
1604
|
+
rules?: () => CustomRulesDeclarationTree;
|
|
1605
|
+
modifiers?: RegleBehaviourOptions;
|
|
1606
|
+
shortcuts?: TShortcuts;
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* useRules is a clone of useRegle, without the need to provide a state.
|
|
1611
|
+
*
|
|
1612
|
+
* It accepts the following inputs:
|
|
1613
|
+
*
|
|
1614
|
+
* @param rules - Your rules object
|
|
1615
|
+
* @param modifiers - Customize regle behaviour
|
|
1616
|
+
*
|
|
1617
|
+
* ```ts
|
|
1618
|
+
* import { useRules } from '@regle/core';
|
|
1619
|
+
import { required } from '@regle/rules';
|
|
1620
|
+
|
|
1621
|
+
const { r$ } = useRules({
|
|
1622
|
+
email: { required }
|
|
1623
|
+
})
|
|
1624
|
+
* ```
|
|
1625
|
+
*/
|
|
1626
|
+
declare const useRules: useRulesFn<Partial<AllRulesDeclarations>, RegleShortcutDefinition<any>>;
|
|
1627
|
+
//#endregion
|
|
1502
1628
|
//#region src/types/utils/props.types.d.ts
|
|
1503
1629
|
/**
|
|
1504
1630
|
* Infer type of the `r$` of any function returning a regle instance
|
|
@@ -1584,7 +1710,7 @@ type HasNamedKeys<T> = IsUnion<T> extends true ? ProcessHasNamedKeys<LazyJoinDis
|
|
|
1584
1710
|
type ProcessHasNamedKeys<T> = { [K in keyof NonNullable<T>]: K extends string ? (string extends K ? never : K) : never }[keyof NonNullable<T>] extends never ? false : true;
|
|
1585
1711
|
//#endregion
|
|
1586
1712
|
//#region src/types/utils/infer.types.d.ts
|
|
1587
|
-
type InferInput<TRules extends MaybeRef<ReglePartialRuleTree<Record<string, any>, any>> | ((state: any) => ReglePartialRuleTree<Record<string, any>, any>)
|
|
1713
|
+
type InferInput<TRules extends MaybeRef<ReglePartialRuleTree<Record<string, any>, any>> | ((state: any) => ReglePartialRuleTree<Record<string, any>, any>) | MaybeRef<StandardSchemaV1<any>>, TMarkMaybe extends boolean = true> = TRules extends MaybeRef<StandardSchemaV1<infer State>> ? State : IsUnion$1<UnwrapSimple<TRules>> extends true ? InferTupleUnionInput<UnionToTuple<UnwrapSimple<TRules>>>[number] : TMarkMaybe extends true ? Prettify<{ [K in keyof UnwrapSimple<TRules> as UnwrapSimple<TRules>[K] extends MaybeRef<RegleRuleDecl<any, any>> ? K : never]?: ProcessInputChildren<UnwrapSimple<TRules>[K], TMarkMaybe> } & { [K in keyof UnwrapSimple<TRules> as UnwrapSimple<TRules>[K] extends MaybeRef<RegleRuleDecl<any, any>> ? never : K]: ProcessInputChildren<UnwrapSimple<TRules>[K], TMarkMaybe> }> : Prettify<{ [K in keyof UnwrapSimple<TRules>]: ProcessInputChildren<UnwrapSimple<TRules>[K], TMarkMaybe> }>;
|
|
1588
1714
|
type ProcessInputChildren<TRule extends unknown, TMarkMaybe extends boolean> = TRule extends {
|
|
1589
1715
|
$each: RegleCollectionEachRules<any, any>;
|
|
1590
1716
|
} ? ExtractFromGetter<TRule['$each']> extends ReglePartialRuleTree<any, any> ? InferInput<ExtractFromGetter<TRule['$each']>, TMarkMaybe>[] : any[] : TRule extends MaybeRef<RegleRuleDecl<any, any>> ? [ExtractTypeFromRules<UnwrapRef<TRule>>] extends [never] ? unknown : ExtractTypeFromRules<UnwrapRef<TRule>> : TRule extends ReglePartialRuleTree<any, any> ? InferInput<TRule, TMarkMaybe> : string;
|
|
@@ -1632,7 +1758,7 @@ type IsLiteral<T> = string extends T ? false : true;
|
|
|
1632
1758
|
/**
|
|
1633
1759
|
* Returned typed of rules created with `createRule`
|
|
1634
1760
|
* */
|
|
1635
|
-
interface RegleRuleDefinition<TValue extends unknown = unknown, TParams extends any[] = [], TAsync extends boolean = boolean, TMetaData extends RegleRuleMetadataDefinition = RegleRuleMetadataDefinition,
|
|
1761
|
+
interface RegleRuleDefinition<TValue extends unknown = unknown, TParams extends any[] = [], TAsync extends boolean = boolean, TMetaData extends RegleRuleMetadataDefinition = RegleRuleMetadataDefinition, _TInput = unknown, TFilteredValue extends any = (TValue extends Date & File & infer M ? M : TValue)> extends RegleInternalRuleDefs<TFilteredValue, TParams, TAsync, TMetaData> {
|
|
1636
1762
|
validator: RegleRuleDefinitionProcessor<TFilteredValue, TParams, TAsync extends false ? TMetaData : Promise<TMetaData>>;
|
|
1637
1763
|
message: (metadata: PossibleRegleRuleMetadataConsumer<TFilteredValue>) => string | string[];
|
|
1638
1764
|
active: (metadata: PossibleRegleRuleMetadataConsumer<TFilteredValue>) => boolean;
|
|
@@ -1641,10 +1767,6 @@ interface RegleRuleDefinition<TValue extends unknown = unknown, TParams extends
|
|
|
1641
1767
|
_value?: IsLiteral<TValue> extends true ? TValue : any;
|
|
1642
1768
|
exec: (value: Maybe<TFilteredValue>) => TAsync extends false ? TMetaData : Promise<TMetaData>;
|
|
1643
1769
|
}
|
|
1644
|
-
/**
|
|
1645
|
-
* @internal
|
|
1646
|
-
* */
|
|
1647
|
-
|
|
1648
1770
|
/**
|
|
1649
1771
|
* Rules with params created with `createRules` are callable while being customizable
|
|
1650
1772
|
*/
|
|
@@ -1688,10 +1810,6 @@ type PossibleRegleRuleMetadataConsumer<TValue> = {
|
|
|
1688
1810
|
} & DefaultMetadataProperties & {
|
|
1689
1811
|
$params?: [...any[]];
|
|
1690
1812
|
};
|
|
1691
|
-
/**
|
|
1692
|
-
* @internal
|
|
1693
|
-
*/
|
|
1694
|
-
|
|
1695
1813
|
/**
|
|
1696
1814
|
* Generic types for a created RegleRule
|
|
1697
1815
|
*/
|
|
@@ -1741,11 +1859,6 @@ interface RegleRuleCore<TValue extends any, TParams extends any[] = [], TAsync e
|
|
|
1741
1859
|
type?: string;
|
|
1742
1860
|
async?: boolean;
|
|
1743
1861
|
}
|
|
1744
|
-
/**
|
|
1745
|
-
* @internal
|
|
1746
|
-
* createRule arguments options
|
|
1747
|
-
*/
|
|
1748
|
-
|
|
1749
1862
|
type RegleRuleTypeReturn<TValue, TParams extends [...any[]]> = {
|
|
1750
1863
|
value: TValue;
|
|
1751
1864
|
params: [...TParams];
|
|
@@ -1895,10 +2008,6 @@ type $InternalRegleCollectionRuleDecl = $InternalRegleRuleDecl & {
|
|
|
1895
2008
|
* @public
|
|
1896
2009
|
*/
|
|
1897
2010
|
type InlineRuleDeclaration<TValue extends any = any, TParams extends any[] = any[], TReturn extends RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition> = boolean> = (value: Maybe<TValue>, ...args: UnwrapRegleUniversalParams<TParams>) => TReturn;
|
|
1898
|
-
/**
|
|
1899
|
-
* @internal
|
|
1900
|
-
*/
|
|
1901
|
-
|
|
1902
2011
|
/**
|
|
1903
2012
|
* @public
|
|
1904
2013
|
* Regroup inline and registered rules
|
|
@@ -1939,7 +2048,7 @@ type RegleStatus<TState extends Record<string, any> | undefined = Record<string,
|
|
|
1939
2048
|
/** Will return a copy of your state with only the fields that are dirty. By default it will filter out nullish values or objects, but you can override it with the first parameter $extractDirtyFields(false). */
|
|
1940
2049
|
$extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TState>;
|
|
1941
2050
|
/** Sets all properties as dirty, triggering all rules. It returns a promise that will either resolve to false or a type safe copy of your form state. Values that had the required rule will be transformed into a non-nullable value (type only). */
|
|
1942
|
-
$validate: () => Promise<
|
|
2051
|
+
$validate: (forceValues?: JoinDiscriminatedUnions<TState> extends EmptyObject ? any : HasNamedKeys<JoinDiscriminatedUnions<TState>> extends true ? IsUnknown<JoinDiscriminatedUnions<TState>> extends true ? any : JoinDiscriminatedUnions<TState> : any) => Promise<RegleNestedResult<JoinDiscriminatedUnions<TState>, TRules>>;
|
|
1943
2052
|
} & ProcessNestedFields<TState, TRules, TShortcuts> & ([TShortcuts['nested']] extends [never] ? {} : { [K in keyof TShortcuts['nested']]: ReturnType<NonNullable<TShortcuts['nested']>[K]> });
|
|
1944
2053
|
/**
|
|
1945
2054
|
* @internal
|
|
@@ -1953,7 +2062,7 @@ interface $InternalRegleStatus extends $InternalRegleCommonStatus {
|
|
|
1953
2062
|
readonly $errors: Record<string, $InternalRegleErrors>;
|
|
1954
2063
|
readonly $silentErrors: Record<string, $InternalRegleErrors>;
|
|
1955
2064
|
$extractDirtyFields: (filterNullishValues?: boolean) => Record<string, any>;
|
|
1956
|
-
$validate: () => Promise<$InternalRegleResult>;
|
|
2065
|
+
$validate: (forceValues?: any) => Promise<$InternalRegleResult>;
|
|
1957
2066
|
}
|
|
1958
2067
|
/**
|
|
1959
2068
|
* @public
|
|
@@ -2015,7 +2124,7 @@ type RegleFieldStatus<TState extends any = any, TRules extends RegleFormProperty
|
|
|
2015
2124
|
/** Will return a copy of your state with only the fields that are dirty. By default it will filter out nullish values or objects, but you can override it with the first parameter $extractDirtyFields(false). */
|
|
2016
2125
|
$extractDirtyFields: (filterNullishValues?: boolean) => MaybeOutput<TState>;
|
|
2017
2126
|
/** Sets all properties as dirty, triggering all rules. It returns a promise that will either resolve to false or a type safe copy of your form state. Values that had the required rule will be transformed into a non-nullable value (type only). */
|
|
2018
|
-
$validate: () => Promise<
|
|
2127
|
+
$validate: (forceValues?: IsUnknown<TState> extends true ? any : TState) => Promise<RegleFieldResult<TState, TRules>>;
|
|
2019
2128
|
/** This is reactive tree containing all the declared rules of your field. To know more about the rule properties check the rules properties section */
|
|
2020
2129
|
readonly $rules: ComputeFieldRules<TState, TRules>;
|
|
2021
2130
|
} & ([TShortcuts['fields']] extends [never] ? {} : { [K in keyof TShortcuts['fields']]: ReturnType<NonNullable<TShortcuts['fields']>[K]> });
|
|
@@ -2035,12 +2144,12 @@ interface $InternalRegleFieldStatus extends $InternalRegleCommonStatus {
|
|
|
2035
2144
|
readonly $issues: RegleFieldIssue[];
|
|
2036
2145
|
readonly $isDebouncing: boolean;
|
|
2037
2146
|
$extractDirtyFields: (filterNullishValues?: boolean) => any;
|
|
2038
|
-
$validate: () => Promise<$InternalRegleResult>;
|
|
2147
|
+
$validate: (forceValues?: any) => Promise<$InternalRegleResult>;
|
|
2039
2148
|
}
|
|
2040
2149
|
/**
|
|
2041
2150
|
* @public
|
|
2042
2151
|
*/
|
|
2043
|
-
interface RegleCommonStatus<TValue = any> {
|
|
2152
|
+
interface RegleCommonStatus<TValue = any> extends StandardSchemaV1<TValue> {
|
|
2044
2153
|
/** Indicates whether the field is invalid. It becomes true if any associated rules return false. */
|
|
2045
2154
|
readonly $invalid: boolean;
|
|
2046
2155
|
/**
|
|
@@ -2195,7 +2304,7 @@ type RegleCollectionStatus<TState extends any[] = any[], TRules extends ReglePar
|
|
|
2195
2304
|
/** Will return a copy of your state with only the fields that are dirty. By default it will filter out nullish values or objects, but you can override it with the first parameter $extractDirtyFields(false). */
|
|
2196
2305
|
$extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TState>;
|
|
2197
2306
|
/** Sets all properties as dirty, triggering all rules. It returns a promise that will either resolve to false or a type safe copy of your form state. Values that had the required rule will be transformed into a non-nullable value (type only). */
|
|
2198
|
-
$validate: () => Promise<
|
|
2307
|
+
$validate: (value?: JoinDiscriminatedUnions<TState>) => Promise<RegleCollectionResult<TState, JoinDiscriminatedUnions<TRules>>>;
|
|
2199
2308
|
} & ([TShortcuts['collections']] extends [never] ? {} : { [K in keyof TShortcuts['collections']]: ReturnType<NonNullable<TShortcuts['collections']>[K]> });
|
|
2200
2309
|
/**
|
|
2201
2310
|
* @internal
|
|
@@ -2209,7 +2318,7 @@ interface $InternalRegleCollectionStatus extends Omit<$InternalRegleStatus, '$fi
|
|
|
2209
2318
|
readonly $silentErrors: $InternalRegleCollectionErrors;
|
|
2210
2319
|
readonly $externalErrors?: string[];
|
|
2211
2320
|
$extractDirtyFields: (filterNullishValues?: boolean) => any[];
|
|
2212
|
-
$validate: () => Promise<$InternalRegleResult>;
|
|
2321
|
+
$validate: (forceValues?: any) => Promise<$InternalRegleResult>;
|
|
2213
2322
|
}
|
|
2214
2323
|
//#endregion
|
|
2215
2324
|
//#region src/types/rules/rule.errors.types.d.ts
|
|
@@ -2253,7 +2362,7 @@ type SuperCompatibleRegleRoot = SuperCompatibleRegleStatus & {
|
|
|
2253
2362
|
$groups?: {
|
|
2254
2363
|
[x: string]: RegleValidationGroupOutput;
|
|
2255
2364
|
};
|
|
2256
|
-
$validate: () => Promise<SuperCompatibleRegleResult>;
|
|
2365
|
+
$validate: (...args: any[]) => Promise<SuperCompatibleRegleResult>;
|
|
2257
2366
|
};
|
|
2258
2367
|
type SuperCompatibleRegleResult = $InternalRegleResult;
|
|
2259
2368
|
type SuperCompatibleRegleStatus = {
|
|
@@ -2337,11 +2446,6 @@ declare function createRule<TValue extends any, TParams extends any[], TReturn e
|
|
|
2337
2446
|
* Removing Ref and executing function to return the unwrapped value
|
|
2338
2447
|
*/
|
|
2339
2448
|
declare function unwrapRuleParameters<TParams extends any[]>(params: MaybeRefOrGetter[]): TParams;
|
|
2340
|
-
/**
|
|
2341
|
-
* Returns a clean list of parameters
|
|
2342
|
-
* Removing Ref and executing function to return the unwrapped value
|
|
2343
|
-
*/
|
|
2344
|
-
|
|
2345
2449
|
//#endregion
|
|
2346
2450
|
//#region src/core/defineRegleConfig.d.ts
|
|
2347
2451
|
/**
|
|
@@ -2367,6 +2471,7 @@ declare function defineRegleConfig<TShortcuts extends RegleShortcutDefinition<TC
|
|
|
2367
2471
|
}): {
|
|
2368
2472
|
useRegle: useRegleFn<TCustomRules, TShortcuts>;
|
|
2369
2473
|
inferRules: inferRulesFn<TCustomRules>;
|
|
2474
|
+
useRules: useRulesFn<TCustomRules, TShortcuts>;
|
|
2370
2475
|
};
|
|
2371
2476
|
/**
|
|
2372
2477
|
* Extend an already created custom `useRegle` (as the first parameter)
|
|
@@ -2403,10 +2508,12 @@ type MergedRegles<TRegles extends Record<string, SuperCompatibleRegleRoot>, TVal
|
|
|
2403
2508
|
readonly $errors: { [K in keyof TRegles]: TRegles[K]['$errors'] };
|
|
2404
2509
|
/** Collection of all the error messages, collected for all children properties. */
|
|
2405
2510
|
readonly $silentErrors: { [K in keyof TRegles]: TRegles[K]['$silentErrors'] };
|
|
2511
|
+
readonly $issues: { [K in keyof TRegles]: TRegles[K]['$issues'] };
|
|
2512
|
+
readonly $silentIssues: { [K in keyof TRegles]: TRegles[K]['$silentIssues'] };
|
|
2406
2513
|
/** Will return a copy of your state with only the fields that are dirty. By default it will filter out nullish values or objects, but you can override it with the first parameter $extractDirtyFields(false). */
|
|
2407
2514
|
$extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TValue>;
|
|
2408
2515
|
/** Sets all properties as dirty, triggering all rules. It returns a promise that will either resolve to false or a type safe copy of your form state. Values that had the required rule will be transformed into a non-nullable value (type only). */
|
|
2409
|
-
$validate: () => Promise<MergedReglesResult<TRegles>>;
|
|
2516
|
+
$validate: (forceValues?: TRegles['$value']) => Promise<MergedReglesResult<TRegles>>;
|
|
2410
2517
|
};
|
|
2411
2518
|
type MergedScopedRegles<TValue extends Record<string, unknown>[] = Record<string, unknown>[]> = Omit<MergedRegles<Record<string, SuperCompatibleRegleRoot>, TValue>, '$instances' | '$errors' | '$silentErrors' | '$value' | '$silentValue' | '$validate'> & {
|
|
2412
2519
|
/** Array of scoped Regles instances */
|
|
@@ -2417,10 +2524,16 @@ type MergedScopedRegles<TValue extends Record<string, unknown>[] = Record<string
|
|
|
2417
2524
|
readonly $errors: RegleValidationErrors<Record<string, unknown>>[];
|
|
2418
2525
|
/** Collection of all registered Regles instances silent errors */
|
|
2419
2526
|
readonly $silentErrors: RegleValidationErrors<Record<string, unknown>>[];
|
|
2527
|
+
/** Collection of all registered Regles instances issues */
|
|
2528
|
+
readonly $issues: RegleValidationErrors<Record<string, unknown>, false, true>[];
|
|
2529
|
+
/** Collection of all registered Regles instances silent issues */
|
|
2530
|
+
readonly $silentIssues: RegleValidationErrors<Record<string, unknown>, false, true>[];
|
|
2420
2531
|
/** Sets all properties as dirty, triggering all rules. It returns a promise that will either resolve to false or a type safe copy of your form state. Values that had the required rule will be transformed into a non-nullable value (type only). */
|
|
2421
|
-
$validate: () => Promise<{
|
|
2532
|
+
$validate: (forceValues?: TValue) => Promise<{
|
|
2422
2533
|
valid: boolean;
|
|
2423
2534
|
data: TValue;
|
|
2535
|
+
errors: RegleValidationErrors<Record<string, unknown>>[];
|
|
2536
|
+
issues: RegleValidationErrors<Record<string, unknown>>[];
|
|
2424
2537
|
}>;
|
|
2425
2538
|
};
|
|
2426
2539
|
type MergedReglesResult<TRegles extends Record<string, SuperCompatibleRegleRoot>> = {
|
|
@@ -2428,11 +2541,15 @@ type MergedReglesResult<TRegles extends Record<string, SuperCompatibleRegleRoot>
|
|
|
2428
2541
|
data: { [K in keyof TRegles]: Extract<PromiseReturn<ReturnType<TRegles[K]['$validate']>>, {
|
|
2429
2542
|
valid: false;
|
|
2430
2543
|
}>['data'] };
|
|
2544
|
+
errors: { [K in keyof TRegles]: TRegles[K]['$errors'] };
|
|
2545
|
+
issues: { [K in keyof TRegles]: TRegles[K]['$issues'] };
|
|
2431
2546
|
} | {
|
|
2432
2547
|
valid: true;
|
|
2433
2548
|
data: { [K in keyof TRegles]: Extract<PromiseReturn<ReturnType<TRegles[K]['$validate']>>, {
|
|
2434
2549
|
valid: true;
|
|
2435
2550
|
}>['data'] };
|
|
2551
|
+
errors: EmptyObject;
|
|
2552
|
+
issues: EmptyObject;
|
|
2436
2553
|
};
|
|
2437
2554
|
declare function mergeRegles<TRegles extends Record<string, SuperCompatibleRegleRoot>, TScoped extends boolean = false>(regles: TRegles, _scoped?: TScoped): TScoped extends false ? MergedRegles<TRegles> : MergedScopedRegles;
|
|
2438
2555
|
//#endregion
|
|
@@ -2563,4 +2680,4 @@ declare function defineRules<TRules extends RegleUnknownRulesTree>(rules: TRules
|
|
|
2563
2680
|
*/
|
|
2564
2681
|
declare function refineRules<TRules extends RegleUnknownRulesTree, TRefinement extends ReglePartialRuleTree<InferInput<TRules>> & RegleUnknownRulesTree>(rules: TRules, refinement: (state: Ref<InferInput<TRules>>) => TRefinement): (state: Ref<InferInput<TRules>>) => Merge<TRules, TRefinement>;
|
|
2565
2682
|
//#endregion
|
|
2566
|
-
export { type $InternalRegleStatus, type AllRulesDeclarations, type CommonAlphaOptions, type CommonComparisonOptions, type CreateScopedUseRegleOptions, type DeepMaybeRef, type DeepReactiveState, type DefaultValidatorsTree, type FormRuleDeclaration, type HasNamedKeys, type HaveAnyRequiredProps, type InferInput, type InferRegleRoot, type InferRegleRule, type InferRegleRules, type InferRegleShortcuts, type InferRegleStatusType, type InferSafeOutput, type InlineRuleDeclaration, InternalRuleType, type JoinDiscriminatedUnions, type LocalRegleBehaviourOptions, type Maybe, type MaybeInput, type MaybeOutput, type MaybeReadonly, type MaybeVariantStatus, type MergedRegles, type MergedScopedRegles, type NarrowVariant, type NoInferLegacy, type NonEmptyTuple, type PrimitiveTypes, type Regle, type RegleBehaviourOptions, type RegleCollectionErrors, type RegleCollectionRuleDecl, type RegleCollectionRuleDefinition, type RegleCollectionStatus, type RegleCommonStatus, type RegleComputedRules, type RegleCustomFieldStatus, type RegleEnforceCustomRequiredRules, type RegleEnforceRequiredRules, type RegleErrorTree, type RegleExternalCollectionErrors, type RegleExternalErrorTree, type RegleExternalSchemaErrorTree, type RegleFieldIssue, type RegleFieldStatus, type RegleFormPropertyType, type RegleInternalRuleDefs, type RegleIssuesTree, type ReglePartialRuleTree, type RegleResult, type RegleRoot, type RegleRuleCore, type RegleRuleDecl, type RegleRuleDefinition, type RegleRuleDefinitionProcessor, type RegleRuleDefinitionWithMetadataProcessor, type RegleRuleInit, type RegleRuleMetadataConsumer, type RegleRuleMetadataDefinition, type RegleRuleMetadataExtended, type RegleRuleRaw, type RegleRuleStatus, type RegleRuleTypeReturn, type RegleRuleWithParamsDefinition, type RegleShortcutDefinition, type RegleSingleField, type RegleStatus, type RegleUniversalParams, type RegleUnknownRulesTree, type RegleValidationErrors, type RegleValidationGroupEntry, type RegleValidationGroupOutput, type RegleRuleTree as RegleValidationTree, type ResolvedRegleBehaviourOptions, type ScopedInstancesRecord, type ScopedInstancesRecordLike, type SuperCompatibleRegle, type SuperCompatibleRegleCollectionErrors, type SuperCompatibleRegleCollectionStatus, type SuperCompatibleRegleFieldStatus, type SuperCompatibleRegleResult, type SuperCompatibleRegleRoot, type SuperCompatibleRegleRuleStatus, type SuperCompatibleRegleStatus, type Unwrap, type UnwrapRegleUniversalParams, type UnwrapRuleWithParams, type UseScopedRegleOptions, createRule, createScopedUseRegle, createVariant, defineRegleConfig, defineRules, extendRegleConfig, flatErrors, inferRules, type inferRulesFn, mergeRegles, narrowVariant, refineRules, unwrapRuleParameters, useCollectScope, type useCollectScopeFn, useRegle, type useRegleFn, useRootStorage, useScopedRegle, variantToRef };
|
|
2683
|
+
export { type $InternalRegleStatus, type AllRulesDeclarations, type ArrayElement, type CommonAlphaOptions, type CommonComparisonOptions, type CreateScopedUseRegleOptions, type DeepMaybeRef, type DeepReactiveState, type DefaultValidatorsTree, type FormRuleDeclaration, type HasNamedKeys, type HaveAnyRequiredProps, type InferInput, type InferRegleRoot, type InferRegleRule, type InferRegleRules, type InferRegleShortcuts, type InferRegleStatusType, type InferSafeOutput, type InlineRuleDeclaration, InternalRuleType, type JoinDiscriminatedUnions, type LocalRegleBehaviourOptions, type Maybe, type MaybeInput, type MaybeOutput, type MaybeReadonly, type MaybeVariantStatus, type MergedRegles, type MergedScopedRegles, type NarrowVariant, type NoInferLegacy, type NonEmptyTuple, type PrimitiveTypes, type Regle, type RegleBehaviourOptions, type RegleCollectionErrors, type RegleCollectionRuleDecl, type RegleCollectionRuleDefinition, type RegleCollectionStatus, type RegleCommonStatus, type RegleComputedRules, type RegleCustomFieldStatus, type RegleEnforceCustomRequiredRules, type RegleEnforceRequiredRules, type RegleErrorTree, type RegleExternalCollectionErrors, type RegleExternalErrorTree, type RegleExternalSchemaErrorTree, type RegleFieldIssue, type RegleFieldStatus, type RegleFormPropertyType, type RegleInternalRuleDefs, type RegleIssuesTree, type ReglePartialRuleTree, type RegleResult, type RegleRoot, type RegleRuleCore, type RegleRuleDecl, type RegleRuleDefinition, type RegleRuleDefinitionProcessor, type RegleRuleDefinitionWithMetadataProcessor, type RegleRuleInit, type RegleRuleMetadataConsumer, type RegleRuleMetadataDefinition, type RegleRuleMetadataExtended, type RegleRuleRaw, type RegleRuleStatus, type RegleRuleTypeReturn, type RegleRuleWithParamsDefinition, type RegleShortcutDefinition, type RegleSingleField, type RegleStatus, type RegleUniversalParams, type RegleUnknownRulesTree, type RegleValidationErrors, type RegleValidationGroupEntry, type RegleValidationGroupOutput, type RegleRuleTree as RegleValidationTree, type ResolvedRegleBehaviourOptions, type ScopedInstancesRecord, type ScopedInstancesRecordLike, type SuperCompatibleRegle, type SuperCompatibleRegleCollectionErrors, type SuperCompatibleRegleCollectionStatus, type SuperCompatibleRegleFieldStatus, type SuperCompatibleRegleResult, type SuperCompatibleRegleRoot, type SuperCompatibleRegleRuleStatus, type SuperCompatibleRegleStatus, type Unwrap, type UnwrapRegleUniversalParams, type UnwrapRuleWithParams, type UseScopedRegleOptions, createRule, createScopedUseRegle, createVariant, defineRegleConfig, defineRules, extendRegleConfig, flatErrors, inferRules, type inferRulesFn, mergeRegles, narrowVariant, refineRules, unwrapRuleParameters, useCollectScope, type useCollectScopeFn, useRegle, type useRegleFn, useRootStorage, useRules, type useRulesFn, useScopedRegle, variantToRef };
|