@pawover/kit 0.0.0-beta.5 → 0.0.0-beta.6
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/hooks-react.d.ts +6 -0
- package/dist/hooks-react.d.ts.map +1 -1
- package/dist/hooks-react.js +7 -19
- package/dist/hooks-react.js.map +1 -1
- package/dist/index.d.ts +1489 -219
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +117 -102
- package/dist/index.js.map +1 -1
- package/dist/patches-fetchEventSource.d.ts +9 -0
- package/dist/patches-fetchEventSource.d.ts.map +1 -1
- package/dist/patches-fetchEventSource.js +1 -0
- package/dist/patches-fetchEventSource.js.map +1 -1
- package/metadata.json +5 -2
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -122,58 +122,31 @@ declare function arrayReplace<T>(initialList: readonly T[], newItem: T, match: (
|
|
|
122
122
|
*/
|
|
123
123
|
declare function arraySplit<T>(initialList: readonly T[], size?: number): T[][];
|
|
124
124
|
//#endregion
|
|
125
|
-
//#region src/utils/
|
|
126
|
-
/**
|
|
127
|
-
* @param promise
|
|
128
|
-
* @param errorExt 可以传递给err对象的其他信息
|
|
129
|
-
*/
|
|
130
|
-
declare function to<T, U$1 = Error>(promise: Readonly<Promise<T>>, errorExt?: PlainObject): Promise<[U$1, undefined] | [null, T]>;
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/utils/math/toMathBignumber.d.ts
|
|
125
|
+
//#region src/utils/device/isMobile.d.ts
|
|
133
126
|
/**
|
|
134
|
-
*
|
|
127
|
+
* 检测当前设备是否为移动设备
|
|
135
128
|
*
|
|
136
|
-
* @param
|
|
137
|
-
* @param
|
|
138
|
-
* @param saveValue 安全值
|
|
129
|
+
* @param maxWidth - 移动设备最大宽度(默认 768px)
|
|
130
|
+
* @param dpi - 标准 DPI 基准(默认 160)
|
|
139
131
|
*/
|
|
140
|
-
declare function
|
|
141
|
-
//#endregion
|
|
142
|
-
//#region src/utils/math/toMathDecimal.d.ts
|
|
132
|
+
declare function isMobile(maxWidth?: number, dpi?: number): boolean;
|
|
143
133
|
/**
|
|
144
|
-
*
|
|
134
|
+
* 检测当前设备是否为IOS移动设备
|
|
145
135
|
*
|
|
146
|
-
* @param
|
|
147
|
-
* @param
|
|
148
|
-
* @param precision 精度
|
|
149
|
-
* @param isFormat 是否格式化为字符串
|
|
136
|
+
* @param maxWidth - 移动设备最大宽度(默认 768px)
|
|
137
|
+
* @param dpi - 标准 DPI 基准(默认 160)
|
|
150
138
|
*/
|
|
151
|
-
declare function
|
|
152
|
-
declare function toMathDecimal(mathJsInstance: MathJsInstance, value: unknown, precision?: number | undefined, isFormat?: false): BigNumber;
|
|
139
|
+
declare function isISOMobile(maxWidth?: number, dpi?: number): boolean;
|
|
153
140
|
//#endregion
|
|
154
|
-
//#region src/utils/
|
|
141
|
+
//#region src/utils/device/isTablet.d.ts
|
|
155
142
|
/**
|
|
156
|
-
*
|
|
143
|
+
* 检测当前设备是否为平板
|
|
157
144
|
*
|
|
158
|
-
* @param
|
|
159
|
-
* @param
|
|
160
|
-
* @param
|
|
161
|
-
*/
|
|
162
|
-
declare function toMathEvaluate(mathJsInstance: MathJsInstance, expr: MathExpression | Matrix, scope?: Record<string, BigNumber>): string;
|
|
163
|
-
//#endregion
|
|
164
|
-
//#region src/utils/object/cloneDeep.d.ts
|
|
165
|
-
interface CloningStrategy {
|
|
166
|
-
cloneMap: <K$1, V>(parent: Map<K$1, V>, track: (newParent: Map<K$1, V>) => Map<K$1, V>, clone: <T>(value: T) => T) => Map<K$1, V> | null;
|
|
167
|
-
cloneSet: <T>(parent: Set<T>, track: (newParent: Set<T>) => Set<T>, clone: <T>(value: T) => T) => Set<T> | null;
|
|
168
|
-
cloneArray: <T>(parent: readonly T[], track: (newParent: T[]) => T[], clone: <T>(value: T) => T) => T[] | null;
|
|
169
|
-
cloneObject: <T extends AnyObject>(parent: T, track: (newParent: T) => T, clone: <T>(value: T) => T) => T | null;
|
|
170
|
-
cloneOther: <T>(parent: T, track: (newParent: T) => T, clone: <T>(value: T) => T) => T | null;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* cloneDeep
|
|
174
|
-
* @reference https://github.com/radashi-org/radashi/blob/main/src/object/cloneDeep.ts
|
|
145
|
+
* @param minWidth - 平板最小宽度(默认 768px)
|
|
146
|
+
* @param maxWidth - 平板最大宽度(默认 1200px)
|
|
147
|
+
* @param dpi - 标准 DPI 基准(默认 160)
|
|
175
148
|
*/
|
|
176
|
-
declare function
|
|
149
|
+
declare function isTablet(minWidth?: number, maxWidth?: number, dpi?: number): boolean;
|
|
177
150
|
//#endregion
|
|
178
151
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/basic.d.ts
|
|
179
152
|
/**
|
|
@@ -334,7 +307,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
334
307
|
@category Type Guard
|
|
335
308
|
@category Utilities
|
|
336
309
|
*/
|
|
337
|
-
type IsOptionalKeyOf<Type extends object, Key$
|
|
310
|
+
type IsOptionalKeyOf<Type$1 extends object, Key$2 extends keyof Type$1> = IsAny<Type$1 | Key$2> extends true ? never : Key$2 extends keyof Type$1 ? Type$1 extends Record<Key$2, Type$1[Key$2]> ? false : true : false;
|
|
338
311
|
//#endregion
|
|
339
312
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
340
313
|
/**
|
|
@@ -370,8 +343,8 @@ const update2: UpdateOperation<User> = {
|
|
|
370
343
|
|
|
371
344
|
@category Utilities
|
|
372
345
|
*/
|
|
373
|
-
type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
374
|
-
? (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`
|
|
346
|
+
type OptionalKeysOf<Type$1 extends object> = Type$1 extends unknown // For distributing `Type`
|
|
347
|
+
? (keyof { [Key in keyof Type$1 as IsOptionalKeyOf<Type$1, Key> extends false ? never : Key]: never }) & keyof Type$1 // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
|
|
375
348
|
: never;
|
|
376
349
|
//#endregion
|
|
377
350
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/required-keys-of.d.ts
|
|
@@ -405,67 +378,8 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
|
405
378
|
|
|
406
379
|
@category Utilities
|
|
407
380
|
*/
|
|
408
|
-
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
409
|
-
? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/has-required-keys.d.ts
|
|
412
|
-
/**
|
|
413
|
-
Creates a type that represents `true` or `false` depending on whether the given type has any required fields.
|
|
414
|
-
|
|
415
|
-
This is useful when you want to create an API whose behavior depends on the presence or absence of required fields.
|
|
416
|
-
|
|
417
|
-
@example
|
|
418
|
-
```
|
|
419
|
-
import type {HasRequiredKeys} from 'type-fest';
|
|
420
|
-
|
|
421
|
-
type GeneratorOptions<Template extends object> = {
|
|
422
|
-
prop1: number;
|
|
423
|
-
prop2: string;
|
|
424
|
-
} & (HasRequiredKeys<Template> extends true
|
|
425
|
-
? {template: Template}
|
|
426
|
-
: {template?: Template});
|
|
427
|
-
|
|
428
|
-
type Template1 = {
|
|
429
|
-
optionalSubParam?: string;
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
type Template2 = {
|
|
433
|
-
requiredSubParam: string;
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
type Options1 = GeneratorOptions<Template1>;
|
|
437
|
-
type Options2 = GeneratorOptions<Template2>;
|
|
438
|
-
|
|
439
|
-
const optA: Options1 = {
|
|
440
|
-
prop1: 0,
|
|
441
|
-
prop2: 'hi',
|
|
442
|
-
};
|
|
443
|
-
const optB: Options1 = {
|
|
444
|
-
prop1: 0,
|
|
445
|
-
prop2: 'hi',
|
|
446
|
-
template: {},
|
|
447
|
-
};
|
|
448
|
-
const optC: Options1 = {
|
|
449
|
-
prop1: 0,
|
|
450
|
-
prop2: 'hi',
|
|
451
|
-
template: {
|
|
452
|
-
optionalSubParam: 'optional value',
|
|
453
|
-
},
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
const optD: Options2 = {
|
|
457
|
-
prop1: 0,
|
|
458
|
-
prop2: 'hi',
|
|
459
|
-
template: {
|
|
460
|
-
requiredSubParam: 'required value',
|
|
461
|
-
},
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
@category Utilities
|
|
467
|
-
*/
|
|
468
|
-
type HasRequiredKeys<BaseType extends object> = RequiredKeysOf<BaseType> extends never ? false : true;
|
|
381
|
+
type RequiredKeysOf<Type$1 extends object> = Type$1 extends unknown // For distributing `Type`
|
|
382
|
+
? Exclude<keyof Type$1, OptionalKeysOf<Type$1>> : never;
|
|
469
383
|
//#endregion
|
|
470
384
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-never.d.ts
|
|
471
385
|
/**
|
|
@@ -616,10 +530,50 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
|
616
530
|
@category Type Guard
|
|
617
531
|
@category Utilities
|
|
618
532
|
*/
|
|
619
|
-
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
533
|
+
type If<Type$1 extends boolean, IfBranch, ElseBranch> = IsNever<Type$1> extends true ? ElseBranch : Type$1 extends true ? IfBranch : ElseBranch;
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/unknown-array.d.ts
|
|
536
|
+
/**
|
|
537
|
+
Represents an array with `unknown` value.
|
|
538
|
+
|
|
539
|
+
Use case: You want a type that all arrays can be assigned to, but you don't care about the value.
|
|
540
|
+
|
|
541
|
+
@example
|
|
542
|
+
```
|
|
543
|
+
import type {UnknownArray} from 'type-fest';
|
|
544
|
+
|
|
545
|
+
type IsArray<T> = T extends UnknownArray ? true : false;
|
|
546
|
+
|
|
547
|
+
type A = IsArray<['foo']>;
|
|
548
|
+
//=> true
|
|
549
|
+
|
|
550
|
+
type B = IsArray<readonly number[]>;
|
|
551
|
+
//=> true
|
|
552
|
+
|
|
553
|
+
type C = IsArray<string>;
|
|
554
|
+
//=> false
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
@category Type
|
|
558
|
+
@category Array
|
|
559
|
+
*/
|
|
560
|
+
type UnknownArray = readonly unknown[];
|
|
620
561
|
//#endregion
|
|
621
562
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/internal/type.d.ts
|
|
622
563
|
/**
|
|
564
|
+
Returns a boolean for whether A is false.
|
|
565
|
+
|
|
566
|
+
@example
|
|
567
|
+
```
|
|
568
|
+
type A = Not<true>;
|
|
569
|
+
//=> false
|
|
570
|
+
|
|
571
|
+
type B = Not<false>;
|
|
572
|
+
//=> true
|
|
573
|
+
```
|
|
574
|
+
*/
|
|
575
|
+
type Not<A$1 extends boolean> = A$1 extends true ? false : A$1 extends false ? true : never;
|
|
576
|
+
/**
|
|
623
577
|
An if-else-like type that resolves depending on whether the given type is `any` or `never`.
|
|
624
578
|
|
|
625
579
|
@example
|
|
@@ -664,6 +618,407 @@ type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
|
|
|
664
618
|
```
|
|
665
619
|
*/
|
|
666
620
|
type IfNotAnyOrNever<T, IfNotAnyOrNever$1, IfAny = any, IfNever = never> = If<IsAny<T>, IfAny, If<IsNever<T>, IfNever, IfNotAnyOrNever$1>>;
|
|
621
|
+
/**
|
|
622
|
+
Indicates the value of `exactOptionalPropertyTypes` compiler option.
|
|
623
|
+
*/
|
|
624
|
+
type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?] ? false : true;
|
|
625
|
+
//#endregion
|
|
626
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/internal/array.d.ts
|
|
627
|
+
/**
|
|
628
|
+
Transforms a tuple type by replacing it's rest element with a single element that has the same type as the rest element, while keeping all the non-rest elements intact.
|
|
629
|
+
|
|
630
|
+
@example
|
|
631
|
+
```
|
|
632
|
+
type A = CollapseRestElement<[string, string, ...number[]]>;
|
|
633
|
+
//=> [string, string, number]
|
|
634
|
+
|
|
635
|
+
type B = CollapseRestElement<[...string[], number, number]>;
|
|
636
|
+
//=> [string, number, number]
|
|
637
|
+
|
|
638
|
+
type C = CollapseRestElement<[string, string, ...Array<number | bigint>]>;
|
|
639
|
+
//=> [string, string, number | bigint]
|
|
640
|
+
|
|
641
|
+
type D = CollapseRestElement<[string, number]>;
|
|
642
|
+
//=> [string, number]
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
Note: Optional modifiers (`?`) are removed from elements unless the `exactOptionalPropertyTypes` compiler option is disabled. When disabled, there's an additional `| undefined` for optional elements.
|
|
646
|
+
|
|
647
|
+
@example
|
|
648
|
+
```
|
|
649
|
+
// `exactOptionalPropertyTypes` enabled
|
|
650
|
+
type A = CollapseRestElement<[string?, string?, ...number[]]>;
|
|
651
|
+
//=> [string, string, number]
|
|
652
|
+
|
|
653
|
+
// `exactOptionalPropertyTypes` disabled
|
|
654
|
+
type B = CollapseRestElement<[string?, string?, ...number[]]>;
|
|
655
|
+
//=> [string | undefined, string | undefined, number]
|
|
656
|
+
```
|
|
657
|
+
*/
|
|
658
|
+
type CollapseRestElement<TArray extends UnknownArray> = IfNotAnyOrNever<TArray, _CollapseRestElement<TArray>>;
|
|
659
|
+
type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extends UnknownArray = [], BackwardAccumulator extends UnknownArray = []> = TArray extends UnknownArray // For distributing `TArray`
|
|
660
|
+
? keyof TArray & `${number}` extends never
|
|
661
|
+
// Enters this branch, if `TArray` is empty (e.g., []),
|
|
662
|
+
// or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
|
|
663
|
+
? TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.
|
|
664
|
+
: TArray extends readonly [] ? [...ForwardAccumulator, ...BackwardAccumulator] : [...ForwardAccumulator, TArray[number], ...BackwardAccumulator] // Add the rest element between the accumulated elements.
|
|
665
|
+
: TArray extends readonly [(infer First)?, ...infer Rest] ? _CollapseRestElement<Rest, [...ForwardAccumulator, '0' extends OptionalKeysOf<TArray> ? If<IsExactOptionalPropertyTypesEnabled, First, First | undefined> // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.
|
|
666
|
+
: First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
|
|
667
|
+
: never; // Should never happen
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/numeric.d.ts
|
|
670
|
+
type _Numeric = number | bigint;
|
|
671
|
+
type Zero = 0 | 0n;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
Matches the hidden `Infinity` type.
|
|
675
|
+
|
|
676
|
+
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.
|
|
677
|
+
|
|
678
|
+
@see {@link NegativeInfinity}
|
|
679
|
+
|
|
680
|
+
@category Numeric
|
|
681
|
+
*/
|
|
682
|
+
// See https://github.com/microsoft/TypeScript/issues/31752
|
|
683
|
+
// eslint-disable-next-line no-loss-of-precision
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
A negative `number`/`bigint` (`-∞ < x < 0`)
|
|
687
|
+
|
|
688
|
+
Use-case: Validating and documenting parameters.
|
|
689
|
+
|
|
690
|
+
@see {@link NegativeInteger}
|
|
691
|
+
@see {@link NonNegative}
|
|
692
|
+
|
|
693
|
+
@category Numeric
|
|
694
|
+
*/
|
|
695
|
+
type Negative<T extends _Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never;
|
|
696
|
+
/**
|
|
697
|
+
Returns a boolean for whether the given number is a negative number.
|
|
698
|
+
|
|
699
|
+
@see {@link Negative}
|
|
700
|
+
|
|
701
|
+
@example
|
|
702
|
+
```
|
|
703
|
+
import type {IsNegative} from 'type-fest';
|
|
704
|
+
|
|
705
|
+
type ShouldBeFalse = IsNegative<1>;
|
|
706
|
+
type ShouldBeTrue = IsNegative<-1>;
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
@category Numeric
|
|
710
|
+
*/
|
|
711
|
+
type IsNegative<T extends _Numeric> = T extends Negative<T> ? true : false;
|
|
712
|
+
//#endregion
|
|
713
|
+
//#region node_modules/.pnpm/tagged-tag@1.0.0/node_modules/tagged-tag/index.d.ts
|
|
714
|
+
declare const tag: unique symbol;
|
|
715
|
+
//#endregion
|
|
716
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/tagged.d.ts
|
|
717
|
+
// eslint-disable-next-line type-fest/require-exported-types
|
|
718
|
+
type TagContainer<Token> = {
|
|
719
|
+
readonly [tag]: Token;
|
|
720
|
+
};
|
|
721
|
+
type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{ [K in Token]: TagMetadata }>;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
Attach a "tag" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for distinct concepts in your program that should not be interchangeable, even if their runtime values have the same type. (See examples.)
|
|
725
|
+
|
|
726
|
+
A type returned by `Tagged` can be passed to `Tagged` again, to create a type with multiple tags.
|
|
727
|
+
|
|
728
|
+
[Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)
|
|
729
|
+
|
|
730
|
+
A tag's name is usually a string (and must be a string, number, or symbol), but each application of a tag can also contain an arbitrary type as its "metadata". See {@link GetTagMetadata} for examples and explanation.
|
|
731
|
+
|
|
732
|
+
A type `A` returned by `Tagged` is assignable to another type `B` returned by `Tagged` if and only if:
|
|
733
|
+
- the underlying (untagged) type of `A` is assignable to the underlying type of `B`;
|
|
734
|
+
- `A` contains at least all the tags `B` has;
|
|
735
|
+
- and the metadata type for each of `A`'s tags is assignable to the metadata type of `B`'s corresponding tag.
|
|
736
|
+
|
|
737
|
+
There have been several discussions about adding similar features to TypeScript. Unfortunately, nothing has (yet) moved forward:
|
|
738
|
+
- [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)
|
|
739
|
+
- [Microsoft/TypeScript#4895](https://github.com/microsoft/TypeScript/issues/4895)
|
|
740
|
+
- [Microsoft/TypeScript#33290](https://github.com/microsoft/TypeScript/pull/33290)
|
|
741
|
+
|
|
742
|
+
@example
|
|
743
|
+
```
|
|
744
|
+
import type {Tagged} from 'type-fest';
|
|
745
|
+
|
|
746
|
+
type AccountNumber = Tagged<number, 'AccountNumber'>;
|
|
747
|
+
type AccountBalance = Tagged<number, 'AccountBalance'>;
|
|
748
|
+
|
|
749
|
+
function createAccountNumber(): AccountNumber {
|
|
750
|
+
// As you can see, casting from a `number` (the underlying type being tagged) is allowed.
|
|
751
|
+
return 2 as AccountNumber;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
declare function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance;
|
|
755
|
+
|
|
756
|
+
// This will compile successfully.
|
|
757
|
+
getMoneyForAccount(createAccountNumber());
|
|
758
|
+
|
|
759
|
+
// But this won't, because it has to be explicitly passed as an `AccountNumber` type!
|
|
760
|
+
// Critically, you could not accidentally use an `AccountBalance` as an `AccountNumber`.
|
|
761
|
+
// @ts-expect-error
|
|
762
|
+
getMoneyForAccount(2);
|
|
763
|
+
|
|
764
|
+
// You can also use tagged values like their underlying, untagged type.
|
|
765
|
+
// I.e., this will compile successfully because an `AccountNumber` can be used as a regular `number`.
|
|
766
|
+
// In this sense, the underlying base type is not hidden, which differentiates tagged types from opaque types in other languages.
|
|
767
|
+
const accountNumber = createAccountNumber() + 2;
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
@example
|
|
771
|
+
```
|
|
772
|
+
import type {Tagged} from 'type-fest';
|
|
773
|
+
|
|
774
|
+
// You can apply multiple tags to a type by using `Tagged` repeatedly.
|
|
775
|
+
type Url = Tagged<string, 'URL'>;
|
|
776
|
+
type SpecialCacheKey = Tagged<Url, 'SpecialCacheKey'>;
|
|
777
|
+
|
|
778
|
+
// You can also pass a union of tag names, so this is equivalent to the above, although it doesn't give you the ability to assign distinct metadata to each tag.
|
|
779
|
+
type SpecialCacheKey2 = Tagged<string, 'URL' | 'SpecialCacheKey'>;
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
@category Type
|
|
783
|
+
*/
|
|
784
|
+
type Tagged<Type$1, TagName extends PropertyKey, TagMetadata = never> = Type$1 & Tag<TagName, TagMetadata>;
|
|
785
|
+
/**
|
|
786
|
+
Revert a tagged type back to its original type by removing all tags.
|
|
787
|
+
|
|
788
|
+
Why is this necessary?
|
|
789
|
+
|
|
790
|
+
1. Use a `Tagged` type as object keys
|
|
791
|
+
2. Prevent TS4058 error: "Return type of exported function has or is using name X from external module Y but cannot be named"
|
|
792
|
+
|
|
793
|
+
@example
|
|
794
|
+
```
|
|
795
|
+
import type {Tagged, UnwrapTagged} from 'type-fest';
|
|
796
|
+
|
|
797
|
+
type AccountType = Tagged<'SAVINGS' | 'CHECKING', 'AccountType'>;
|
|
798
|
+
|
|
799
|
+
const moneyByAccountType: Record<UnwrapTagged<AccountType>, number> = {
|
|
800
|
+
SAVINGS: 99,
|
|
801
|
+
CHECKING: 0.1,
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
// Without UnwrapTagged, the following expression would throw a type error.
|
|
805
|
+
const money = moneyByAccountType.SAVINGS; // TS error: Property 'SAVINGS' does not exist
|
|
806
|
+
|
|
807
|
+
// Attempting to pass an non-Tagged type to UnwrapTagged will raise a type error.
|
|
808
|
+
// @ts-expect-error
|
|
809
|
+
type WontWork = UnwrapTagged<string>;
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
@category Type
|
|
813
|
+
*/
|
|
814
|
+
type UnwrapTagged<TaggedType extends Tag<PropertyKey, any>> = RemoveAllTags<TaggedType>;
|
|
815
|
+
type RemoveAllTags<T> = T extends Tag<PropertyKey, any> ? { [ThisTag in keyof T[typeof tag]]: T extends Tagged<infer Type, ThisTag, T[typeof tag][ThisTag]> ? RemoveAllTags<Type> : never }[keyof T[typeof tag]] : T;
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
Note: The `Opaque` type is deprecated in favor of `Tagged`.
|
|
819
|
+
|
|
820
|
+
Attach a "tag" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for runtime values that would otherwise have the same type. (See examples.)
|
|
821
|
+
|
|
822
|
+
The generic type parameters can be anything.
|
|
823
|
+
|
|
824
|
+
Note that `Opaque` is somewhat of a misnomer here, in that, unlike [some alternative implementations](https://github.com/microsoft/TypeScript/issues/4895#issuecomment-425132582), the original, untagged type is not actually hidden. (E.g., functions that accept the untagged type can still be called with the "opaque" version -- but not vice-versa.)
|
|
825
|
+
|
|
826
|
+
Also note that this implementation is limited to a single tag. If you want to allow multiple tags, use `Tagged` instead.
|
|
827
|
+
|
|
828
|
+
[Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)
|
|
829
|
+
|
|
830
|
+
There have been several discussions about adding similar features to TypeScript. Unfortunately, nothing has (yet) moved forward:
|
|
831
|
+
- [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)
|
|
832
|
+
- [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408)
|
|
833
|
+
- [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807)
|
|
834
|
+
|
|
835
|
+
@example
|
|
836
|
+
```
|
|
837
|
+
import type {Opaque} from 'type-fest';
|
|
838
|
+
|
|
839
|
+
type AccountNumber = Opaque<number, 'AccountNumber'>;
|
|
840
|
+
type AccountBalance = Opaque<number, 'AccountBalance'>;
|
|
841
|
+
|
|
842
|
+
// The `Token` parameter allows the compiler to differentiate between types, whereas "unknown" will not. For example, consider the following structures:
|
|
843
|
+
type ThingOne = Opaque<string>;
|
|
844
|
+
type ThingTwo = Opaque<string>;
|
|
845
|
+
|
|
846
|
+
// To the compiler, these types are allowed to be cast to each other as they have the same underlying type. They are both `string & { __opaque__: unknown }`.
|
|
847
|
+
// To avoid this behaviour, you would instead pass the "Token" parameter, like so.
|
|
848
|
+
type NewThingOne = Opaque<string, 'ThingOne'>;
|
|
849
|
+
type NewThingTwo = Opaque<string, 'ThingTwo'>;
|
|
850
|
+
|
|
851
|
+
// Now they're completely separate types, so the following will fail to compile.
|
|
852
|
+
function createNewThingOne(): NewThingOne {
|
|
853
|
+
// As you can see, casting from a string is still allowed. However, you may not cast NewThingOne to NewThingTwo, and vice versa.
|
|
854
|
+
return 'new thing one' as NewThingOne;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// This will fail to compile, as they are fundamentally different types.
|
|
858
|
+
// @ts-expect-error
|
|
859
|
+
const thingTwo = createNewThingOne() as NewThingTwo;
|
|
860
|
+
|
|
861
|
+
// Here's another example of opaque typing.
|
|
862
|
+
function createAccountNumber(): AccountNumber {
|
|
863
|
+
return 2 as AccountNumber;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
declare function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance;
|
|
867
|
+
|
|
868
|
+
// This will compile successfully.
|
|
869
|
+
getMoneyForAccount(createAccountNumber());
|
|
870
|
+
|
|
871
|
+
// But this won't, because it has to be explicitly passed as an `AccountNumber` type.
|
|
872
|
+
// @ts-expect-error
|
|
873
|
+
getMoneyForAccount(2);
|
|
874
|
+
|
|
875
|
+
// You can use opaque values like they aren't opaque too.
|
|
876
|
+
const accountNumber = createAccountNumber();
|
|
877
|
+
|
|
878
|
+
// This will compile successfully.
|
|
879
|
+
const newAccountNumber = accountNumber + 2;
|
|
880
|
+
|
|
881
|
+
// As a side note, you can (and should) use recursive types for your opaque types to make them stronger and hopefully easier to type.
|
|
882
|
+
type Person = {
|
|
883
|
+
id: Opaque<number, Person>;
|
|
884
|
+
name: string;
|
|
885
|
+
};
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
@category Type
|
|
889
|
+
@deprecated Use {@link Tagged} instead
|
|
890
|
+
*/
|
|
891
|
+
//#endregion
|
|
892
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-literal.d.ts
|
|
893
|
+
/**
|
|
894
|
+
Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
|
|
895
|
+
|
|
896
|
+
Useful for:
|
|
897
|
+
- providing strongly-typed string manipulation functions
|
|
898
|
+
- constraining strings to be a string literal
|
|
899
|
+
- type utilities, such as when constructing parsers and ASTs
|
|
900
|
+
|
|
901
|
+
The implementation of this type is inspired by the trick mentioned in this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
|
|
902
|
+
|
|
903
|
+
@example
|
|
904
|
+
```
|
|
905
|
+
import type {IsStringLiteral} from 'type-fest';
|
|
906
|
+
|
|
907
|
+
type CapitalizedString<T extends string> = IsStringLiteral<T> extends true ? Capitalize<T> : string;
|
|
908
|
+
|
|
909
|
+
// https://github.com/yankeeinlondon/native-dash/blob/master/src/capitalize.ts
|
|
910
|
+
function capitalize<T extends Readonly<string>>(input: T): CapitalizedString<T> {
|
|
911
|
+
return (input.slice(0, 1).toUpperCase() + input.slice(1)) as CapitalizedString<T>;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
const output = capitalize('hello, world!');
|
|
915
|
+
//=> 'Hello, world!'
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
@example
|
|
919
|
+
```
|
|
920
|
+
// String types with infinite set of possible values return `false`.
|
|
921
|
+
|
|
922
|
+
import type {IsStringLiteral} from 'type-fest';
|
|
923
|
+
|
|
924
|
+
type AllUppercaseStrings = IsStringLiteral<Uppercase<string>>;
|
|
925
|
+
//=> false
|
|
926
|
+
|
|
927
|
+
type StringsStartingWithOn = IsStringLiteral<`on${string}`>;
|
|
928
|
+
//=> false
|
|
929
|
+
|
|
930
|
+
// This behaviour is particularly useful in string manipulation utilities, as infinite string types often require separate handling.
|
|
931
|
+
|
|
932
|
+
type Length<S extends string, Counter extends never[] = []> =
|
|
933
|
+
IsStringLiteral<S> extends false
|
|
934
|
+
? number // return `number` for infinite string types
|
|
935
|
+
: S extends `${string}${infer Tail}`
|
|
936
|
+
? Length<Tail, [...Counter, never]>
|
|
937
|
+
: Counter['length'];
|
|
938
|
+
|
|
939
|
+
type L1 = Length<Lowercase<string>>;
|
|
940
|
+
//=> number
|
|
941
|
+
|
|
942
|
+
type L2 = Length<`${number}`>;
|
|
943
|
+
//=> number
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
@category Type Guard
|
|
947
|
+
@category Utilities
|
|
948
|
+
*/
|
|
949
|
+
type IsStringLiteral<S> = IfNotAnyOrNever<S, _IsStringLiteral<CollapseLiterals<S extends TagContainer<any> ? UnwrapTagged<S> : S>>, false, false>;
|
|
950
|
+
type _IsStringLiteral<S> =
|
|
951
|
+
// If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
|
|
952
|
+
// and since `{}` extends index signatures, the result becomes `false`.
|
|
953
|
+
S extends string ? {} extends Record<S, never> ? false : true : false;
|
|
954
|
+
//#endregion
|
|
955
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/tuple-of.d.ts
|
|
956
|
+
/**
|
|
957
|
+
Create a tuple type of the specified length with elements of the specified type.
|
|
958
|
+
|
|
959
|
+
@example
|
|
960
|
+
```
|
|
961
|
+
import type {TupleOf} from 'type-fest';
|
|
962
|
+
|
|
963
|
+
type RGB = TupleOf<3, number>;
|
|
964
|
+
//=> [number, number, number]
|
|
965
|
+
|
|
966
|
+
type Line = TupleOf<2, {x: number; y: number}>;
|
|
967
|
+
//=> [{x: number; y: number}, {x: number; y: number}]
|
|
968
|
+
|
|
969
|
+
type TicTacToeBoard = TupleOf<3, TupleOf<3, 'X' | 'O' | null>>;
|
|
970
|
+
//=> [['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null], ['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null], ['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null]]
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
@example
|
|
974
|
+
```
|
|
975
|
+
import type {TupleOf} from 'type-fest';
|
|
976
|
+
|
|
977
|
+
type Range<Start extends number, End extends number> = Exclude<keyof TupleOf<End>, keyof TupleOf<Start>>;
|
|
978
|
+
|
|
979
|
+
type ZeroToFour = Range<0, 5>;
|
|
980
|
+
//=> '0' | '1' | '2' | '3' | '4'
|
|
981
|
+
|
|
982
|
+
type ThreeToEight = Range<3, 9>;
|
|
983
|
+
//=> '3' | '4' | '5' | '6' | '7' | '8'
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
Note: If the specified length is the non-literal `number` type, the result will not be a tuple but a regular array.
|
|
987
|
+
|
|
988
|
+
@example
|
|
989
|
+
```
|
|
990
|
+
import type {TupleOf} from 'type-fest';
|
|
991
|
+
|
|
992
|
+
type StringArray = TupleOf<number, string>;
|
|
993
|
+
//=> string[]
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
Note: If the type for elements is not specified, it will default to `unknown`.
|
|
997
|
+
|
|
998
|
+
@example
|
|
999
|
+
```
|
|
1000
|
+
import type {TupleOf} from 'type-fest';
|
|
1001
|
+
|
|
1002
|
+
type UnknownTriplet = TupleOf<3>;
|
|
1003
|
+
//=> [unknown, unknown, unknown]
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
Note: If the specified length is negative, the result will be an empty tuple.
|
|
1007
|
+
|
|
1008
|
+
@example
|
|
1009
|
+
```
|
|
1010
|
+
import type {TupleOf} from 'type-fest';
|
|
1011
|
+
|
|
1012
|
+
type EmptyTuple = TupleOf<-3, string>;
|
|
1013
|
+
//=> []
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
Note: If you need a readonly tuple, simply wrap this type with `Readonly`, for example, to create `readonly [number, number, number]` use `Readonly<TupleOf<3, number>>`.
|
|
1017
|
+
|
|
1018
|
+
@category Array
|
|
1019
|
+
*/
|
|
1020
|
+
type TupleOf<Length extends number, Fill = unknown> = IfNotAnyOrNever<Length, _TupleOf<If<IsNegative<Length>, 0, Length>, Fill, []>, Fill[], []>;
|
|
1021
|
+
type _TupleOf<L$1 extends number, Fill, Accumulator extends UnknownArray> = number extends L$1 ? Fill[] : L$1 extends Accumulator['length'] ? Accumulator : _TupleOf<L$1, Fill, [...Accumulator, Fill]>;
|
|
667
1022
|
//#endregion
|
|
668
1023
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/simplify.d.ts
|
|
669
1024
|
/**
|
|
@@ -1027,6 +1382,282 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
1027
1382
|
```
|
|
1028
1383
|
*/
|
|
1029
1384
|
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<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>>>>;
|
|
1385
|
+
// `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
|
|
1389
|
+
|
|
1390
|
+
Note: This doesn't collapse literals within tagged types. For example, `CollapseLiterals<Tagged<'foo' | (string & {}), 'Tag'>>` returns `("foo" & Tag<"Tag", never>) | (string & Tag<"Tag", never>)` and not `string & Tag<"Tag", never>`.
|
|
1391
|
+
|
|
1392
|
+
Use-case: For collapsing unions created using {@link LiteralUnion}.
|
|
1393
|
+
|
|
1394
|
+
@example
|
|
1395
|
+
```
|
|
1396
|
+
import type {LiteralUnion} from 'type-fest';
|
|
1397
|
+
|
|
1398
|
+
type A = CollapseLiterals<'foo' | 'bar' | (string & {})>;
|
|
1399
|
+
//=> string
|
|
1400
|
+
|
|
1401
|
+
type B = CollapseLiterals<LiteralUnion<1 | 2 | 3, number>>;
|
|
1402
|
+
//=> number
|
|
1403
|
+
|
|
1404
|
+
type C = CollapseLiterals<LiteralUnion<'onClick' | 'onChange', `on${string}`>>;
|
|
1405
|
+
//=> `on${string}`
|
|
1406
|
+
|
|
1407
|
+
type D = CollapseLiterals<'click' | 'change' | (`on${string}` & {})>;
|
|
1408
|
+
//=> 'click' | 'change' | `on${string}`
|
|
1409
|
+
|
|
1410
|
+
type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined>;
|
|
1411
|
+
//=> string | null | undefined
|
|
1412
|
+
```
|
|
1413
|
+
*/
|
|
1414
|
+
type CollapseLiterals<T> = {} extends T ? T : T extends infer U & {} ? U : T;
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/or.d.ts
|
|
1417
|
+
/**
|
|
1418
|
+
Returns a boolean for whether either of two given types is true.
|
|
1419
|
+
|
|
1420
|
+
Use-case: Constructing complex conditional types where at least one condition must be satisfied.
|
|
1421
|
+
|
|
1422
|
+
@example
|
|
1423
|
+
```
|
|
1424
|
+
import type {Or} from 'type-fest';
|
|
1425
|
+
|
|
1426
|
+
type TT = Or<true, true>;
|
|
1427
|
+
//=> true
|
|
1428
|
+
|
|
1429
|
+
type TF = Or<true, false>;
|
|
1430
|
+
//=> true
|
|
1431
|
+
|
|
1432
|
+
type FT = Or<false, true>;
|
|
1433
|
+
//=> true
|
|
1434
|
+
|
|
1435
|
+
type FF = Or<false, false>;
|
|
1436
|
+
//=> false
|
|
1437
|
+
```
|
|
1438
|
+
|
|
1439
|
+
Note: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.
|
|
1440
|
+
For example, `Or<false, boolean>` expands to `Or<false, true> | Or<false, false>`, which simplifies to `true | false` (i.e., `boolean`).
|
|
1441
|
+
|
|
1442
|
+
@example
|
|
1443
|
+
```
|
|
1444
|
+
import type {Or} from 'type-fest';
|
|
1445
|
+
|
|
1446
|
+
type A = Or<false, boolean>;
|
|
1447
|
+
//=> boolean
|
|
1448
|
+
|
|
1449
|
+
type B = Or<boolean, false>;
|
|
1450
|
+
//=> boolean
|
|
1451
|
+
|
|
1452
|
+
type C = Or<true, boolean>;
|
|
1453
|
+
//=> true
|
|
1454
|
+
|
|
1455
|
+
type D = Or<boolean, true>;
|
|
1456
|
+
//=> true
|
|
1457
|
+
|
|
1458
|
+
type E = Or<boolean, boolean>;
|
|
1459
|
+
//=> boolean
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
Note: If `never` is passed as an argument, it is treated as `false` and the result is computed accordingly.
|
|
1463
|
+
|
|
1464
|
+
@example
|
|
1465
|
+
```
|
|
1466
|
+
import type {Or} from 'type-fest';
|
|
1467
|
+
|
|
1468
|
+
type A = Or<true, never>;
|
|
1469
|
+
//=> true
|
|
1470
|
+
|
|
1471
|
+
type B = Or<never, true>;
|
|
1472
|
+
//=> true
|
|
1473
|
+
|
|
1474
|
+
type C = Or<false, never>;
|
|
1475
|
+
//=> false
|
|
1476
|
+
|
|
1477
|
+
type D = Or<never, false>;
|
|
1478
|
+
//=> false
|
|
1479
|
+
|
|
1480
|
+
type E = Or<boolean, never>;
|
|
1481
|
+
//=> boolean
|
|
1482
|
+
|
|
1483
|
+
type F = Or<never, boolean>;
|
|
1484
|
+
//=> boolean
|
|
1485
|
+
|
|
1486
|
+
type G = Or<never, never>;
|
|
1487
|
+
//=> false
|
|
1488
|
+
```
|
|
1489
|
+
|
|
1490
|
+
@see {@link And}
|
|
1491
|
+
@see {@link Xor}
|
|
1492
|
+
*/
|
|
1493
|
+
type Or<A$1 extends boolean, B$1 extends boolean> = _Or<If<IsNever<A$1>, false, A$1>, If<IsNever<B$1>, false, B$1>>;
|
|
1494
|
+
// `never` is treated as `false`
|
|
1495
|
+
|
|
1496
|
+
type _Or<A$1 extends boolean, B$1 extends boolean> = A$1 extends true ? true : B$1 extends true ? true : false;
|
|
1497
|
+
//#endregion
|
|
1498
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/all-extend.d.ts
|
|
1499
|
+
/**
|
|
1500
|
+
@see {@link AllExtend}
|
|
1501
|
+
*/
|
|
1502
|
+
type AllExtendOptions = {
|
|
1503
|
+
/**
|
|
1504
|
+
Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
|
|
1505
|
+
- When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
|
|
1506
|
+
- When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
|
|
1507
|
+
@default true
|
|
1508
|
+
@example
|
|
1509
|
+
```
|
|
1510
|
+
import type {AllExtend} from 'type-fest';
|
|
1511
|
+
type A = AllExtend<[1, 2, never], number, {strictNever: true}>;
|
|
1512
|
+
//=> false
|
|
1513
|
+
type B = AllExtend<[1, 2, never], number, {strictNever: false}>;
|
|
1514
|
+
//=> true
|
|
1515
|
+
type C = AllExtend<[never, never], never, {strictNever: true}>;
|
|
1516
|
+
//=> true
|
|
1517
|
+
type D = AllExtend<[never, never], never, {strictNever: false}>;
|
|
1518
|
+
//=> true
|
|
1519
|
+
type E = AllExtend<['a', 'b', never], any, {strictNever: true}>;
|
|
1520
|
+
//=> true
|
|
1521
|
+
type F = AllExtend<['a', 'b', never], any, {strictNever: false}>;
|
|
1522
|
+
//=> true
|
|
1523
|
+
type G = AllExtend<[never, 1], never, {strictNever: true}>;
|
|
1524
|
+
//=> false
|
|
1525
|
+
type H = AllExtend<[never, 1], never, {strictNever: false}>;
|
|
1526
|
+
//=> false
|
|
1527
|
+
```
|
|
1528
|
+
*/
|
|
1529
|
+
strictNever?: boolean;
|
|
1530
|
+
};
|
|
1531
|
+
type DefaultAllExtendOptions = {
|
|
1532
|
+
strictNever: true;
|
|
1533
|
+
};
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
Returns a boolean for whether every element in an array type extends another type.
|
|
1537
|
+
|
|
1538
|
+
@example
|
|
1539
|
+
```
|
|
1540
|
+
import type {AllExtend} from 'type-fest';
|
|
1541
|
+
|
|
1542
|
+
type A = AllExtend<[1, 2, 3], number>;
|
|
1543
|
+
//=> true
|
|
1544
|
+
|
|
1545
|
+
type B = AllExtend<[1, 2, '3'], number>;
|
|
1546
|
+
//=> false
|
|
1547
|
+
|
|
1548
|
+
type C = AllExtend<[number, number | string], number>;
|
|
1549
|
+
//=> boolean
|
|
1550
|
+
|
|
1551
|
+
type D = AllExtend<[true, boolean, true], true>;
|
|
1552
|
+
//=> boolean
|
|
1553
|
+
```
|
|
1554
|
+
|
|
1555
|
+
Note: Behaviour of optional elements depend on the `exactOptionalPropertyTypes` compiler option. When the option is disabled, the target type must include `undefined` for a successful match.
|
|
1556
|
+
|
|
1557
|
+
```
|
|
1558
|
+
import type {AllExtend} from 'type-fest';
|
|
1559
|
+
|
|
1560
|
+
// `exactOptionalPropertyTypes` enabled
|
|
1561
|
+
type A = AllExtend<[1?, 2?, 3?], number>;
|
|
1562
|
+
//=> true
|
|
1563
|
+
|
|
1564
|
+
// `exactOptionalPropertyTypes` disabled
|
|
1565
|
+
type B = AllExtend<[1?, 2?, 3?], number>;
|
|
1566
|
+
//=> false
|
|
1567
|
+
|
|
1568
|
+
// `exactOptionalPropertyTypes` disabled
|
|
1569
|
+
type C = AllExtend<[1?, 2?, 3?], number | undefined>;
|
|
1570
|
+
//=> true
|
|
1571
|
+
```
|
|
1572
|
+
|
|
1573
|
+
@see {@link AllExtendOptions}
|
|
1574
|
+
|
|
1575
|
+
@category Utilities
|
|
1576
|
+
@category Array
|
|
1577
|
+
*/
|
|
1578
|
+
type AllExtend<TArray extends UnknownArray, Type$1, Options extends AllExtendOptions = {}> = _AllExtend<CollapseRestElement<TArray>, Type$1, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
|
|
1579
|
+
type _AllExtend<TArray extends UnknownArray, Type$1, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, If<IsAny<Type$1>, true, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<IsNever<Type$1>, Not<Options['strictNever']>> extends true
|
|
1580
|
+
// If target `Type` is also `never` OR `strictNever` is disabled, recurse further.
|
|
1581
|
+
? _AllExtend<Rest, Type$1, Options> : false : First extends Type$1 ? _AllExtend<Rest, Type$1, Options> : false : true>, false, false>;
|
|
1582
|
+
//#endregion
|
|
1583
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/and.d.ts
|
|
1584
|
+
/**
|
|
1585
|
+
Returns a boolean for whether two given types are both true.
|
|
1586
|
+
|
|
1587
|
+
Use-case: Constructing complex conditional types where multiple conditions must be satisfied.
|
|
1588
|
+
|
|
1589
|
+
@example
|
|
1590
|
+
```
|
|
1591
|
+
import type {And} from 'type-fest';
|
|
1592
|
+
|
|
1593
|
+
type TT = And<true, true>;
|
|
1594
|
+
//=> true
|
|
1595
|
+
|
|
1596
|
+
type TF = And<true, false>;
|
|
1597
|
+
//=> false
|
|
1598
|
+
|
|
1599
|
+
type FT = And<false, true>;
|
|
1600
|
+
//=> false
|
|
1601
|
+
|
|
1602
|
+
type FF = And<false, false>;
|
|
1603
|
+
//=> false
|
|
1604
|
+
```
|
|
1605
|
+
|
|
1606
|
+
Note: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.
|
|
1607
|
+
For example, `And<true, boolean>` expands to `And<true, true> | And<true, false>`, which simplifies to `true | false` (i.e., `boolean`).
|
|
1608
|
+
|
|
1609
|
+
@example
|
|
1610
|
+
```
|
|
1611
|
+
import type {And} from 'type-fest';
|
|
1612
|
+
|
|
1613
|
+
type A = And<true, boolean>;
|
|
1614
|
+
//=> boolean
|
|
1615
|
+
|
|
1616
|
+
type B = And<boolean, true>;
|
|
1617
|
+
//=> boolean
|
|
1618
|
+
|
|
1619
|
+
type C = And<false, boolean>;
|
|
1620
|
+
//=> false
|
|
1621
|
+
|
|
1622
|
+
type D = And<boolean, false>;
|
|
1623
|
+
//=> false
|
|
1624
|
+
|
|
1625
|
+
type E = And<boolean, boolean>;
|
|
1626
|
+
//=> boolean
|
|
1627
|
+
```
|
|
1628
|
+
|
|
1629
|
+
Note: If either of the types is `never`, the result becomes `false`.
|
|
1630
|
+
|
|
1631
|
+
@example
|
|
1632
|
+
```
|
|
1633
|
+
import type {And} from 'type-fest';
|
|
1634
|
+
|
|
1635
|
+
type A = And<true, never>;
|
|
1636
|
+
//=> false
|
|
1637
|
+
|
|
1638
|
+
type B = And<never, true>;
|
|
1639
|
+
//=> false
|
|
1640
|
+
|
|
1641
|
+
type C = And<false, never>;
|
|
1642
|
+
//=> false
|
|
1643
|
+
|
|
1644
|
+
type D = And<never, false>;
|
|
1645
|
+
//=> false
|
|
1646
|
+
|
|
1647
|
+
type E = And<boolean, never>;
|
|
1648
|
+
//=> false
|
|
1649
|
+
|
|
1650
|
+
type F = And<never, boolean>;
|
|
1651
|
+
//=> false
|
|
1652
|
+
|
|
1653
|
+
type G = And<never, never>;
|
|
1654
|
+
//=> false
|
|
1655
|
+
```
|
|
1656
|
+
|
|
1657
|
+
@see {@link Or}
|
|
1658
|
+
@see {@link Xor}
|
|
1659
|
+
*/
|
|
1660
|
+
type And<A$1 extends boolean, B$1 extends boolean> = AllExtend<[A$1, B$1], true>;
|
|
1030
1661
|
//#endregion
|
|
1031
1662
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/except.d.ts
|
|
1032
1663
|
/**
|
|
@@ -1106,93 +1737,26 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
|
1106
1737
|
// Consider the following example:
|
|
1107
1738
|
|
|
1108
1739
|
type UserData = {
|
|
1109
|
-
[metadata: string]: string;
|
|
1110
|
-
email: string;
|
|
1111
|
-
name: string;
|
|
1112
|
-
role: 'admin' | 'user';
|
|
1113
|
-
};
|
|
1114
|
-
|
|
1115
|
-
// `Omit` clearly doesn't behave as expected in this case:
|
|
1116
|
-
type PostPayload = Omit<UserData, 'email'>;
|
|
1117
|
-
//=> { [x: string]: string; [x: number]: string; }
|
|
1118
|
-
|
|
1119
|
-
// In situations like this, `Except` works better.
|
|
1120
|
-
// It simply removes the `email` key while preserving all the other keys.
|
|
1121
|
-
type PostPayloadFixed = Except<UserData, 'email'>;
|
|
1122
|
-
//=> { [x: string]: string; name: string; role: 'admin' | 'user'; }
|
|
1123
|
-
```
|
|
1124
|
-
|
|
1125
|
-
@category Object
|
|
1126
|
-
*/
|
|
1127
|
-
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
|
|
1128
|
-
type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
|
|
1129
|
-
//#endregion
|
|
1130
|
-
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/require-at-least-one.d.ts
|
|
1131
|
-
/**
|
|
1132
|
-
Create a type that requires at least one of the given keys. The remaining keys are kept as is.
|
|
1133
|
-
|
|
1134
|
-
@example
|
|
1135
|
-
```
|
|
1136
|
-
import type {RequireAtLeastOne} from 'type-fest';
|
|
1137
|
-
|
|
1138
|
-
type Responder = {
|
|
1139
|
-
text?: () => string;
|
|
1140
|
-
json?: () => string;
|
|
1141
|
-
secure?: boolean;
|
|
1142
|
-
};
|
|
1143
|
-
|
|
1144
|
-
const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
|
|
1145
|
-
json: () => '{"message": "ok"}',
|
|
1146
|
-
secure: true,
|
|
1147
|
-
};
|
|
1148
|
-
```
|
|
1149
|
-
|
|
1150
|
-
@category Object
|
|
1151
|
-
*/
|
|
1152
|
-
type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, If<IsNever<KeysType>, never, _RequireAtLeastOne<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>>>;
|
|
1153
|
-
type _RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType> = {
|
|
1154
|
-
// For each `Key` in `KeysType` make a mapped type:
|
|
1155
|
-
[Key in KeysType]-?: Required<Pick<ObjectType, Key>> &
|
|
1156
|
-
// 1. Make `Key`'s type required
|
|
1157
|
-
// 2. Make all other keys in `KeysType` optional
|
|
1158
|
-
Partial<Pick<ObjectType, Exclude<KeysType, Key>>> }[KeysType] &
|
|
1159
|
-
// 3. Add the remaining keys not in `KeysType`
|
|
1160
|
-
Except<ObjectType, KeysType>;
|
|
1161
|
-
//#endregion
|
|
1162
|
-
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/non-empty-object.d.ts
|
|
1163
|
-
/**
|
|
1164
|
-
Represents an object with at least 1 non-optional key.
|
|
1165
|
-
|
|
1166
|
-
This is useful when you need an object where all keys are optional, but there must be at least 1 key.
|
|
1167
|
-
|
|
1168
|
-
@example
|
|
1169
|
-
```
|
|
1170
|
-
import type {NonEmptyObject} from 'type-fest';
|
|
1171
|
-
|
|
1172
|
-
type User = {
|
|
1740
|
+
[metadata: string]: string;
|
|
1741
|
+
email: string;
|
|
1173
1742
|
name: string;
|
|
1174
|
-
|
|
1175
|
-
id: number;
|
|
1743
|
+
role: 'admin' | 'user';
|
|
1176
1744
|
};
|
|
1177
1745
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
name: 'Alice',
|
|
1182
|
-
surname: 'Acme',
|
|
1183
|
-
};
|
|
1746
|
+
// `Omit` clearly doesn't behave as expected in this case:
|
|
1747
|
+
type PostPayload = Omit<UserData, 'email'>;
|
|
1748
|
+
//=> { [x: string]: string; [x: number]: string; }
|
|
1184
1749
|
|
|
1185
|
-
//
|
|
1186
|
-
//
|
|
1187
|
-
|
|
1188
|
-
|
|
1750
|
+
// In situations like this, `Except` works better.
|
|
1751
|
+
// It simply removes the `email` key while preserving all the other keys.
|
|
1752
|
+
type PostPayloadFixed = Except<UserData, 'email'>;
|
|
1753
|
+
//=> { [x: string]: string; name: string; role: 'admin' | 'user'; }
|
|
1189
1754
|
```
|
|
1190
1755
|
|
|
1191
|
-
@see Use `IsEmptyObject` to check whether an object is empty.
|
|
1192
|
-
|
|
1193
1756
|
@category Object
|
|
1194
1757
|
*/
|
|
1195
|
-
type
|
|
1758
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
|
|
1759
|
+
type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
|
|
1196
1760
|
//#endregion
|
|
1197
1761
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/union-to-tuple.d.ts
|
|
1198
1762
|
/**
|
|
@@ -1241,7 +1805,7 @@ const petList = Object.keys(pets) as UnionToTuple<Pet>;
|
|
|
1241
1805
|
|
|
1242
1806
|
@category Array
|
|
1243
1807
|
*/
|
|
1244
|
-
type UnionToTuple<T, L = LastOfUnion<T>> = IsNever<T> extends false ? [...UnionToTuple<Exclude<T, L>>, L] : [];
|
|
1808
|
+
type UnionToTuple<T, L$1 = LastOfUnion<T>> = IsNever<T> extends false ? [...UnionToTuple<Exclude<T, L$1>>, L$1] : [];
|
|
1245
1809
|
//#endregion
|
|
1246
1810
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/set-optional.d.ts
|
|
1247
1811
|
/**
|
|
@@ -1301,6 +1865,65 @@ type C = ValueOf<{id: number; name: string; active: boolean}, 'id' | 'name'>;
|
|
|
1301
1865
|
*/
|
|
1302
1866
|
type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
|
|
1303
1867
|
//#endregion
|
|
1868
|
+
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/split.d.ts
|
|
1869
|
+
/**
|
|
1870
|
+
Split options.
|
|
1871
|
+
|
|
1872
|
+
@see {@link Split}
|
|
1873
|
+
*/
|
|
1874
|
+
type SplitOptions = {
|
|
1875
|
+
/**
|
|
1876
|
+
When enabled, instantiations with non-literal string types (e.g., `string`, `Uppercase<string>`, `on${string}`) simply return back `string[]` without performing any splitting, as the exact structure cannot be statically determined.
|
|
1877
|
+
@default true
|
|
1878
|
+
@example
|
|
1879
|
+
```ts
|
|
1880
|
+
import type {Split} from 'type-fest';
|
|
1881
|
+
type Example1 = Split<`foo.${string}.bar`, '.', {strictLiteralChecks: false}>;
|
|
1882
|
+
//=> ['foo', string, 'bar']
|
|
1883
|
+
type Example2 = Split<`foo.${string}`, '.', {strictLiteralChecks: true}>;
|
|
1884
|
+
//=> string[]
|
|
1885
|
+
type Example3 = Split<'foobarbaz', `b${string}`, {strictLiteralChecks: false}>;
|
|
1886
|
+
//=> ['foo', 'r', 'z']
|
|
1887
|
+
type Example4 = Split<'foobarbaz', `b${string}`, {strictLiteralChecks: true}>;
|
|
1888
|
+
//=> string[]
|
|
1889
|
+
```
|
|
1890
|
+
*/
|
|
1891
|
+
strictLiteralChecks?: boolean;
|
|
1892
|
+
};
|
|
1893
|
+
type DefaultSplitOptions = {
|
|
1894
|
+
strictLiteralChecks: true;
|
|
1895
|
+
};
|
|
1896
|
+
|
|
1897
|
+
/**
|
|
1898
|
+
Represents an array of strings split using a given character or character set.
|
|
1899
|
+
|
|
1900
|
+
Use-case: Defining the return type of a method like `String.prototype.split`.
|
|
1901
|
+
|
|
1902
|
+
@example
|
|
1903
|
+
```
|
|
1904
|
+
import type {Split} from 'type-fest';
|
|
1905
|
+
|
|
1906
|
+
declare function split<S extends string, D extends string>(string: S, separator: D): Split<S, D>;
|
|
1907
|
+
|
|
1908
|
+
type Item = 'foo' | 'bar' | 'baz' | 'waldo';
|
|
1909
|
+
const items = 'foo,bar,baz,waldo';
|
|
1910
|
+
const array: Item[] = split(items, ',');
|
|
1911
|
+
```
|
|
1912
|
+
|
|
1913
|
+
@see {@link SplitOptions}
|
|
1914
|
+
|
|
1915
|
+
@category String
|
|
1916
|
+
@category Template literal
|
|
1917
|
+
*/
|
|
1918
|
+
type Split<S extends string, Delimiter extends string, Options extends SplitOptions = {}> = SplitHelper<S, Delimiter, ApplyDefaultOptions<SplitOptions, DefaultSplitOptions, Options>>;
|
|
1919
|
+
type SplitHelper<S extends string, Delimiter extends string, Options extends Required<SplitOptions>, Accumulator extends string[] = []> = S extends string // For distributing `S`
|
|
1920
|
+
? Delimiter extends string // For distributing `Delimiter`
|
|
1921
|
+
// If `strictLiteralChecks` is `false` OR `S` and `Delimiter` both are string literals, then perform the split
|
|
1922
|
+
? Or<Not<Options['strictLiteralChecks']>, And<IsStringLiteral<S>, IsStringLiteral<Delimiter>>> extends true ? S extends `${infer Head}${Delimiter}${infer Tail}` ? SplitHelper<Tail, Delimiter, Options, [...Accumulator, Head]> : Delimiter extends '' ? S extends '' ? Accumulator : [...Accumulator, S] : [...Accumulator, S]
|
|
1923
|
+
// Otherwise, return `string[]`
|
|
1924
|
+
: string[] : never // Should never happen
|
|
1925
|
+
: never; // Should never happen
|
|
1926
|
+
//#endregion
|
|
1304
1927
|
//#region node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/replace.d.ts
|
|
1305
1928
|
type ReplaceOptions = {
|
|
1306
1929
|
all?: boolean;
|
|
@@ -1367,13 +1990,84 @@ type _Replace<Input extends string, Search extends string, Replacement extends s
|
|
|
1367
1990
|
? Replacement extends string // For distributing `Replacement`
|
|
1368
1991
|
? Input extends `${infer Head}${Search}${infer Tail}` ? Options['all'] extends true ? _Replace<Tail, Search, Replacement, Options, `${Accumulator}${Head}${Replacement}`> : `${Head}${Replacement}${Tail}` : `${Accumulator}${Input}` : never : never;
|
|
1369
1992
|
//#endregion
|
|
1993
|
+
//#region node_modules/.pnpm/@pawover+types@0.0.0-alpha._110402f22903360a3e22e90ae898db58/node_modules/@pawover/types/dist/index.d.ts
|
|
1994
|
+
//#endregion
|
|
1995
|
+
//#region src/index.d.ts
|
|
1996
|
+
/** 任意对象类型 */
|
|
1997
|
+
type AnyObject<K$1 extends PropertyKey = PropertyKey, T = any> = Record<K$1, T>;
|
|
1998
|
+
/** 普通对象类型 */
|
|
1999
|
+
type PlainObject<K$1 extends PropertyKey = PropertyKey, T = unknown> = Record<K$1, T>;
|
|
2000
|
+
/** 描述树类型 */
|
|
2001
|
+
type TreeLike<T extends AnyObject, CK extends string = "children"> = T & Record<CK, TreeLike<T, CK>[]>;
|
|
2002
|
+
/** 描述函数类型 */
|
|
2003
|
+
type AnyFunction<P$1 extends any[] = any[], R$1 = any> = (...arg: P$1) => R$1;
|
|
2004
|
+
/** 描述异步函数类型 */
|
|
2005
|
+
type AnyAsyncFunction<P$1 extends any[] = any[], R$1 = any> = (...args: P$1) => Promise<R$1>;
|
|
2006
|
+
type AnyGeneratorFunction<P$1 extends any[] = any[], T = any, R$1 = any, N = any> = (...args: P$1) => Generator<T, R$1, N>;
|
|
2007
|
+
type AnyAsyncGeneratorFunction<P$1 extends any[] = any[], T = any, R$1 = any, N = any> = (...args: P$1) => AsyncGenerator<T, R$1, N>;
|
|
2008
|
+
//#endregion
|
|
2009
|
+
//#endregion
|
|
2010
|
+
//#region src/utils/function/to.d.ts
|
|
2011
|
+
/**
|
|
2012
|
+
* @param promise
|
|
2013
|
+
* @param errorExt 可以传递给err对象的其他信息
|
|
2014
|
+
*/
|
|
2015
|
+
declare function to<T, U$1 = Error>(promise: Readonly<Promise<T>>, errorExt?: PlainObject): Promise<[U$1, undefined] | [null, T]>;
|
|
2016
|
+
//#endregion
|
|
2017
|
+
//#region src/utils/math/toMathBignumber.d.ts
|
|
2018
|
+
/**
|
|
2019
|
+
* 将任意类型的值转换为 `math.bignumber`
|
|
2020
|
+
*
|
|
2021
|
+
* @param mathJsInstance mathJs 实例
|
|
2022
|
+
* @param value 任意类型的值
|
|
2023
|
+
* @param saveValue 安全值
|
|
2024
|
+
*/
|
|
2025
|
+
declare function toMathBignumber(mathJsInstance: MathJsInstance, value: unknown, saveValue?: BigNumber | undefined): BigNumber;
|
|
2026
|
+
//#endregion
|
|
2027
|
+
//#region src/utils/math/toMathDecimal.d.ts
|
|
2028
|
+
/**
|
|
2029
|
+
* 将任意类型的值转换为十进制数字字符串
|
|
2030
|
+
*
|
|
2031
|
+
* @param mathJsInstance mathJs 实例
|
|
2032
|
+
* @param value 任意类型的值
|
|
2033
|
+
* @param precision 精度
|
|
2034
|
+
* @param isFormat 是否格式化为字符串
|
|
2035
|
+
*/
|
|
2036
|
+
declare function toMathDecimal(mathJsInstance: MathJsInstance, value: unknown, precision?: number | undefined, isFormat?: true): string;
|
|
2037
|
+
declare function toMathDecimal(mathJsInstance: MathJsInstance, value: unknown, precision?: number | undefined, isFormat?: false): BigNumber;
|
|
2038
|
+
//#endregion
|
|
2039
|
+
//#region src/utils/math/toMathEvaluate.d.ts
|
|
2040
|
+
/**
|
|
2041
|
+
* 数学表达式求值
|
|
2042
|
+
*
|
|
2043
|
+
* @param mathJsInstance mathJs 实例
|
|
2044
|
+
* @param expr 表达式
|
|
2045
|
+
* @param scope 键值映射
|
|
2046
|
+
*/
|
|
2047
|
+
declare function toMathEvaluate(mathJsInstance: MathJsInstance, expr: MathExpression | Matrix, scope?: Record<string, BigNumber>): string;
|
|
2048
|
+
//#endregion
|
|
2049
|
+
//#region src/utils/object/cloneDeep.d.ts
|
|
2050
|
+
interface CloningStrategy {
|
|
2051
|
+
cloneMap: <K$1, V$1>(parent: Map<K$1, V$1>, track: (newParent: Map<K$1, V$1>) => Map<K$1, V$1>, clone: <T>(value: T) => T) => Map<K$1, V$1> | null;
|
|
2052
|
+
cloneSet: <T>(parent: Set<T>, track: (newParent: Set<T>) => Set<T>, clone: <T>(value: T) => T) => Set<T> | null;
|
|
2053
|
+
cloneArray: <T>(parent: readonly T[], track: (newParent: T[]) => T[], clone: <T>(value: T) => T) => T[] | null;
|
|
2054
|
+
cloneObject: <T extends AnyObject>(parent: T, track: (newParent: T) => T, clone: <T>(value: T) => T) => T | null;
|
|
2055
|
+
cloneOther: <T>(parent: T, track: (newParent: T) => T, clone: <T>(value: T) => T) => T | null;
|
|
2056
|
+
}
|
|
2057
|
+
/**
|
|
2058
|
+
* cloneDeep
|
|
2059
|
+
* @reference https://github.com/radashi-org/radashi/blob/main/src/object/cloneDeep.ts
|
|
2060
|
+
*/
|
|
2061
|
+
declare function cloneDeep<T extends AnyObject>(root: T, customStrategy?: Partial<CloningStrategy>): T;
|
|
2062
|
+
//#endregion
|
|
1370
2063
|
//#region src/utils/object/enumEntries.d.ts
|
|
1371
2064
|
/**
|
|
1372
2065
|
* 返回枚举的属性的键/值数组
|
|
1373
2066
|
*
|
|
1374
2067
|
* @param enumeration 枚举
|
|
1375
2068
|
*/
|
|
1376
|
-
declare function enumEntries<E extends
|
|
2069
|
+
declare function enumEntries<E extends PlainObject>(enumeration: E): [keyof E, E[keyof E]][];
|
|
2070
|
+
declare function enumEntries<E extends AnyObject>(enumeration: E): [keyof E, E[keyof E]][];
|
|
1377
2071
|
//#endregion
|
|
1378
2072
|
//#region src/utils/object/enumKeys.d.ts
|
|
1379
2073
|
/**
|
|
@@ -1381,10 +2075,8 @@ declare function enumEntries<E extends AnyObject>(enumeration: NonEmptyObject<E>
|
|
|
1381
2075
|
*
|
|
1382
2076
|
* @param enumeration 枚举
|
|
1383
2077
|
*/
|
|
1384
|
-
declare function enumKeys<E extends
|
|
1385
|
-
|
|
1386
|
-
//#region src/utils/object/enumTypeCheck.d.ts
|
|
1387
|
-
declare function enumTypeCheck<E extends AnyObject>(enumeration: E): E & Record<PropertyKey, unknown>;
|
|
2078
|
+
declare function enumKeys<E extends PlainObject>(enumeration: E): (keyof E)[];
|
|
2079
|
+
declare function enumKeys<E extends AnyObject>(enumeration: E): (keyof E)[];
|
|
1388
2080
|
//#endregion
|
|
1389
2081
|
//#region src/utils/object/enumValues.d.ts
|
|
1390
2082
|
/**
|
|
@@ -1392,13 +2084,13 @@ declare function enumTypeCheck<E extends AnyObject>(enumeration: E): E & Record<
|
|
|
1392
2084
|
*
|
|
1393
2085
|
* @param enumeration 枚举
|
|
1394
2086
|
*/
|
|
1395
|
-
declare function enumValues<E extends
|
|
2087
|
+
declare function enumValues<E extends PlainObject>(enumeration: E): UnionToTuple<ValueOf<E>>;
|
|
2088
|
+
declare function enumValues<E extends AnyObject>(enumeration: E): UnionToTuple<ValueOf<E>>;
|
|
1396
2089
|
//#endregion
|
|
1397
2090
|
//#region src/utils/object/mapEntries.d.ts
|
|
1398
|
-
declare function mapEntries<K$1 extends PropertyKey, V, NK extends PropertyKey, NV>(obj: PlainObject<K$1, V>, toEntry: (key: K$1, value: V) => [NK, NV]): PlainObject<NK, NV>;
|
|
2091
|
+
declare function mapEntries<K$1 extends PropertyKey, V$1, NK extends PropertyKey, NV>(obj: PlainObject<K$1, V$1>, toEntry: (key: K$1, value: V$1) => [NK, NV]): PlainObject<NK, NV>;
|
|
1399
2092
|
//#endregion
|
|
1400
2093
|
//#region node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.d.cts
|
|
1401
|
-
|
|
1402
2094
|
interface BigInt {
|
|
1403
2095
|
/**
|
|
1404
2096
|
* Returns a string representation of an object.
|
|
@@ -2081,47 +2773,616 @@ TOverride | (IsOptional extends true ? TInitial : never) : Extract<TOverride, ob
|
|
|
2081
2773
|
* @param override 待合并对象
|
|
2082
2774
|
*/
|
|
2083
2775
|
declare function objectAssign<I$1 extends PlainObject, O extends PlainObject>(initial: I$1, override: O): Assign<I$1, O>;
|
|
2776
|
+
declare function objectAssign<I$1 extends AnyObject, O extends AnyObject>(initial: I$1, override: O): Assign<I$1, O>;
|
|
2084
2777
|
//#endregion
|
|
2085
2778
|
//#region src/utils/object/objectCrush.d.ts
|
|
2086
2779
|
type Crush<T> = T extends readonly (infer U)[] ? Record<string, U extends object ? unknown : U> : Simplify<UnionToIntersection<keyof T extends infer Prop ? Prop extends keyof T ? T[Prop] extends infer Value ? ([Extract<Value, object>] extends [never] ? never : Record<string, unknown>) | ([Exclude<Value, object>] extends [never] ? never : [Extract<Value, object>] extends [never] ? { [P in Prop]: Value } : Record<string, unknown>) : never : never : never>>;
|
|
2087
|
-
declare function objectCrush<T extends PlainObject>(
|
|
2780
|
+
declare function objectCrush<T extends PlainObject>(plainObject: T): Crush<T>;
|
|
2781
|
+
declare function objectCrush<T extends AnyObject>(anyObject: T): Crush<T>;
|
|
2088
2782
|
//#endregion
|
|
2089
|
-
//#region
|
|
2783
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Any/Key.d.ts
|
|
2090
2784
|
/**
|
|
2091
|
-
*
|
|
2785
|
+
* Describes index keys for any type
|
|
2786
|
+
*/
|
|
2787
|
+
declare type Key$1 = string | number | symbol;
|
|
2788
|
+
//#endregion
|
|
2789
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/List.d.ts
|
|
2790
|
+
/**
|
|
2791
|
+
* A [[List]]
|
|
2792
|
+
* @param A its type
|
|
2793
|
+
* @returns [[List]]
|
|
2794
|
+
* @example
|
|
2795
|
+
* ```ts
|
|
2796
|
+
* type list0 = [1, 2, 3]
|
|
2797
|
+
* type list1 = number[]
|
|
2798
|
+
* ```
|
|
2799
|
+
*/
|
|
2800
|
+
declare type List<A$1 = any> = ReadonlyArray<A$1>;
|
|
2801
|
+
//#endregion
|
|
2802
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Any/Cast.d.ts
|
|
2803
|
+
/**
|
|
2804
|
+
* Ask TS to re-check that `A1` extends `A2`.
|
|
2805
|
+
* And if it fails, `A2` will be enforced anyway.
|
|
2806
|
+
* Can also be used to add constraints on parameters.
|
|
2807
|
+
* @param A1 to check against
|
|
2808
|
+
* @param A2 to cast to
|
|
2809
|
+
* @returns `A1 | A2`
|
|
2810
|
+
* @example
|
|
2811
|
+
* ```ts
|
|
2812
|
+
* import {A} from 'ts-toolbelt'
|
|
2092
2813
|
*
|
|
2093
|
-
*
|
|
2814
|
+
* type test0 = A.Cast<'42', string> // '42'
|
|
2815
|
+
* type test1 = A.Cast<'42', number> // number
|
|
2816
|
+
* ```
|
|
2094
2817
|
*/
|
|
2095
|
-
declare
|
|
2818
|
+
declare type Cast<A1 extends any, A2 extends any> = A1 extends A2 ? A1 : A2;
|
|
2096
2819
|
//#endregion
|
|
2097
|
-
//#region
|
|
2820
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Object/_Internal.d.ts
|
|
2098
2821
|
/**
|
|
2099
|
-
*
|
|
2100
|
-
*
|
|
2822
|
+
* Describes the permissions/modifiers fields can have
|
|
2823
|
+
* `R`: readonly
|
|
2824
|
+
* `W`: writable
|
|
2825
|
+
* `!`: required
|
|
2826
|
+
* `?`: optional
|
|
2827
|
+
*/
|
|
2828
|
+
declare type Modx = ['?' | '!', 'W' | 'R'];
|
|
2829
|
+
//#endregion
|
|
2830
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Any/Compute.d.ts
|
|
2831
|
+
/**
|
|
2832
|
+
* @hidden
|
|
2833
|
+
*/
|
|
2834
|
+
declare type ComputeRaw<A$1 extends any> = A$1 extends Function ? A$1 : { [K in keyof A$1]: A$1[K] } & unknown;
|
|
2835
|
+
//#endregion
|
|
2836
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Any/Extends.d.ts
|
|
2837
|
+
/**
|
|
2838
|
+
* Check whether `A1` is part of `A2` or not. The difference with
|
|
2839
|
+
* `extends` is that it forces a [[Boolean]] return.
|
|
2840
|
+
* @param A1
|
|
2841
|
+
* @param A2
|
|
2842
|
+
* @returns [[Boolean]]
|
|
2843
|
+
* @example
|
|
2844
|
+
* ```ts
|
|
2845
|
+
* import {A} from 'ts-toolbelt'
|
|
2101
2846
|
*
|
|
2102
|
-
*
|
|
2847
|
+
* type test0 = A.Extends<'a' | 'b', 'b'> // Boolean
|
|
2848
|
+
* type test1 = A.Extends<'a', 'a' | 'b'> // True
|
|
2849
|
+
*
|
|
2850
|
+
* type test2 = A.Extends<{a: string}, {a: any}> // True
|
|
2851
|
+
* type test3 = A.Extends<{a: any}, {a: any, b: any}> // False
|
|
2852
|
+
*
|
|
2853
|
+
* type test4 = A.Extends<never, never> // False
|
|
2854
|
+
* /// Nothing cannot extend nothing, use `A.Equals`
|
|
2855
|
+
* ```
|
|
2103
2856
|
*/
|
|
2104
|
-
declare
|
|
2857
|
+
declare type Extends<A1 extends any, A2 extends any> = [A1] extends [never] ? 0 : A1 extends A2 ? 1 : 0;
|
|
2858
|
+
//#endregion
|
|
2859
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/Iteration.d.ts
|
|
2860
|
+
/**
|
|
2861
|
+
* An entry of `IterationMap`
|
|
2862
|
+
*/
|
|
2863
|
+
declare type Iteration = [value: number, sign: '-' | '0' | '+', prev: keyof IterationMap, next: keyof IterationMap, oppo: keyof IterationMap];
|
|
2864
|
+
declare type IterationMap = {
|
|
2865
|
+
'__': [number, '-' | '0' | '+', '__', '__', '__'];
|
|
2866
|
+
'-100': [-100, '-', '__', '-99', '100'];
|
|
2867
|
+
'-99': [-99, '-', '-100', '-98', '99'];
|
|
2868
|
+
'-98': [-98, '-', '-99', '-97', '98'];
|
|
2869
|
+
'-97': [-97, '-', '-98', '-96', '97'];
|
|
2870
|
+
'-96': [-96, '-', '-97', '-95', '96'];
|
|
2871
|
+
'-95': [-95, '-', '-96', '-94', '95'];
|
|
2872
|
+
'-94': [-94, '-', '-95', '-93', '94'];
|
|
2873
|
+
'-93': [-93, '-', '-94', '-92', '93'];
|
|
2874
|
+
'-92': [-92, '-', '-93', '-91', '92'];
|
|
2875
|
+
'-91': [-91, '-', '-92', '-90', '91'];
|
|
2876
|
+
'-90': [-90, '-', '-91', '-89', '90'];
|
|
2877
|
+
'-89': [-89, '-', '-90', '-88', '89'];
|
|
2878
|
+
'-88': [-88, '-', '-89', '-87', '88'];
|
|
2879
|
+
'-87': [-87, '-', '-88', '-86', '87'];
|
|
2880
|
+
'-86': [-86, '-', '-87', '-85', '86'];
|
|
2881
|
+
'-85': [-85, '-', '-86', '-84', '85'];
|
|
2882
|
+
'-84': [-84, '-', '-85', '-83', '84'];
|
|
2883
|
+
'-83': [-83, '-', '-84', '-82', '83'];
|
|
2884
|
+
'-82': [-82, '-', '-83', '-81', '82'];
|
|
2885
|
+
'-81': [-81, '-', '-82', '-80', '81'];
|
|
2886
|
+
'-80': [-80, '-', '-81', '-79', '80'];
|
|
2887
|
+
'-79': [-79, '-', '-80', '-78', '79'];
|
|
2888
|
+
'-78': [-78, '-', '-79', '-77', '78'];
|
|
2889
|
+
'-77': [-77, '-', '-78', '-76', '77'];
|
|
2890
|
+
'-76': [-76, '-', '-77', '-75', '76'];
|
|
2891
|
+
'-75': [-75, '-', '-76', '-74', '75'];
|
|
2892
|
+
'-74': [-74, '-', '-75', '-73', '74'];
|
|
2893
|
+
'-73': [-73, '-', '-74', '-72', '73'];
|
|
2894
|
+
'-72': [-72, '-', '-73', '-71', '72'];
|
|
2895
|
+
'-71': [-71, '-', '-72', '-70', '71'];
|
|
2896
|
+
'-70': [-70, '-', '-71', '-69', '70'];
|
|
2897
|
+
'-69': [-69, '-', '-70', '-68', '69'];
|
|
2898
|
+
'-68': [-68, '-', '-69', '-67', '68'];
|
|
2899
|
+
'-67': [-67, '-', '-68', '-66', '67'];
|
|
2900
|
+
'-66': [-66, '-', '-67', '-65', '66'];
|
|
2901
|
+
'-65': [-65, '-', '-66', '-64', '65'];
|
|
2902
|
+
'-64': [-64, '-', '-65', '-63', '64'];
|
|
2903
|
+
'-63': [-63, '-', '-64', '-62', '63'];
|
|
2904
|
+
'-62': [-62, '-', '-63', '-61', '62'];
|
|
2905
|
+
'-61': [-61, '-', '-62', '-60', '61'];
|
|
2906
|
+
'-60': [-60, '-', '-61', '-59', '60'];
|
|
2907
|
+
'-59': [-59, '-', '-60', '-58', '59'];
|
|
2908
|
+
'-58': [-58, '-', '-59', '-57', '58'];
|
|
2909
|
+
'-57': [-57, '-', '-58', '-56', '57'];
|
|
2910
|
+
'-56': [-56, '-', '-57', '-55', '56'];
|
|
2911
|
+
'-55': [-55, '-', '-56', '-54', '55'];
|
|
2912
|
+
'-54': [-54, '-', '-55', '-53', '54'];
|
|
2913
|
+
'-53': [-53, '-', '-54', '-52', '53'];
|
|
2914
|
+
'-52': [-52, '-', '-53', '-51', '52'];
|
|
2915
|
+
'-51': [-51, '-', '-52', '-50', '51'];
|
|
2916
|
+
'-50': [-50, '-', '-51', '-49', '50'];
|
|
2917
|
+
'-49': [-49, '-', '-50', '-48', '49'];
|
|
2918
|
+
'-48': [-48, '-', '-49', '-47', '48'];
|
|
2919
|
+
'-47': [-47, '-', '-48', '-46', '47'];
|
|
2920
|
+
'-46': [-46, '-', '-47', '-45', '46'];
|
|
2921
|
+
'-45': [-45, '-', '-46', '-44', '45'];
|
|
2922
|
+
'-44': [-44, '-', '-45', '-43', '44'];
|
|
2923
|
+
'-43': [-43, '-', '-44', '-42', '43'];
|
|
2924
|
+
'-42': [-42, '-', '-43', '-41', '42'];
|
|
2925
|
+
'-41': [-41, '-', '-42', '-40', '41'];
|
|
2926
|
+
'-40': [-40, '-', '-41', '-39', '40'];
|
|
2927
|
+
'-39': [-39, '-', '-40', '-38', '39'];
|
|
2928
|
+
'-38': [-38, '-', '-39', '-37', '38'];
|
|
2929
|
+
'-37': [-37, '-', '-38', '-36', '37'];
|
|
2930
|
+
'-36': [-36, '-', '-37', '-35', '36'];
|
|
2931
|
+
'-35': [-35, '-', '-36', '-34', '35'];
|
|
2932
|
+
'-34': [-34, '-', '-35', '-33', '34'];
|
|
2933
|
+
'-33': [-33, '-', '-34', '-32', '33'];
|
|
2934
|
+
'-32': [-32, '-', '-33', '-31', '32'];
|
|
2935
|
+
'-31': [-31, '-', '-32', '-30', '31'];
|
|
2936
|
+
'-30': [-30, '-', '-31', '-29', '30'];
|
|
2937
|
+
'-29': [-29, '-', '-30', '-28', '29'];
|
|
2938
|
+
'-28': [-28, '-', '-29', '-27', '28'];
|
|
2939
|
+
'-27': [-27, '-', '-28', '-26', '27'];
|
|
2940
|
+
'-26': [-26, '-', '-27', '-25', '26'];
|
|
2941
|
+
'-25': [-25, '-', '-26', '-24', '25'];
|
|
2942
|
+
'-24': [-24, '-', '-25', '-23', '24'];
|
|
2943
|
+
'-23': [-23, '-', '-24', '-22', '23'];
|
|
2944
|
+
'-22': [-22, '-', '-23', '-21', '22'];
|
|
2945
|
+
'-21': [-21, '-', '-22', '-20', '21'];
|
|
2946
|
+
'-20': [-20, '-', '-21', '-19', '20'];
|
|
2947
|
+
'-19': [-19, '-', '-20', '-18', '19'];
|
|
2948
|
+
'-18': [-18, '-', '-19', '-17', '18'];
|
|
2949
|
+
'-17': [-17, '-', '-18', '-16', '17'];
|
|
2950
|
+
'-16': [-16, '-', '-17', '-15', '16'];
|
|
2951
|
+
'-15': [-15, '-', '-16', '-14', '15'];
|
|
2952
|
+
'-14': [-14, '-', '-15', '-13', '14'];
|
|
2953
|
+
'-13': [-13, '-', '-14', '-12', '13'];
|
|
2954
|
+
'-12': [-12, '-', '-13', '-11', '12'];
|
|
2955
|
+
'-11': [-11, '-', '-12', '-10', '11'];
|
|
2956
|
+
'-10': [-10, '-', '-11', '-9', '10'];
|
|
2957
|
+
'-9': [-9, '-', '-10', '-8', '9'];
|
|
2958
|
+
'-8': [-8, '-', '-9', '-7', '8'];
|
|
2959
|
+
'-7': [-7, '-', '-8', '-6', '7'];
|
|
2960
|
+
'-6': [-6, '-', '-7', '-5', '6'];
|
|
2961
|
+
'-5': [-5, '-', '-6', '-4', '5'];
|
|
2962
|
+
'-4': [-4, '-', '-5', '-3', '4'];
|
|
2963
|
+
'-3': [-3, '-', '-4', '-2', '3'];
|
|
2964
|
+
'-2': [-2, '-', '-3', '-1', '2'];
|
|
2965
|
+
'-1': [-1, '-', '-2', '0', '1'];
|
|
2966
|
+
'0': [0, '0', '-1', '1', '0'];
|
|
2967
|
+
'1': [1, '+', '0', '2', '-1'];
|
|
2968
|
+
'2': [2, '+', '1', '3', '-2'];
|
|
2969
|
+
'3': [3, '+', '2', '4', '-3'];
|
|
2970
|
+
'4': [4, '+', '3', '5', '-4'];
|
|
2971
|
+
'5': [5, '+', '4', '6', '-5'];
|
|
2972
|
+
'6': [6, '+', '5', '7', '-6'];
|
|
2973
|
+
'7': [7, '+', '6', '8', '-7'];
|
|
2974
|
+
'8': [8, '+', '7', '9', '-8'];
|
|
2975
|
+
'9': [9, '+', '8', '10', '-9'];
|
|
2976
|
+
'10': [10, '+', '9', '11', '-10'];
|
|
2977
|
+
'11': [11, '+', '10', '12', '-11'];
|
|
2978
|
+
'12': [12, '+', '11', '13', '-12'];
|
|
2979
|
+
'13': [13, '+', '12', '14', '-13'];
|
|
2980
|
+
'14': [14, '+', '13', '15', '-14'];
|
|
2981
|
+
'15': [15, '+', '14', '16', '-15'];
|
|
2982
|
+
'16': [16, '+', '15', '17', '-16'];
|
|
2983
|
+
'17': [17, '+', '16', '18', '-17'];
|
|
2984
|
+
'18': [18, '+', '17', '19', '-18'];
|
|
2985
|
+
'19': [19, '+', '18', '20', '-19'];
|
|
2986
|
+
'20': [20, '+', '19', '21', '-20'];
|
|
2987
|
+
'21': [21, '+', '20', '22', '-21'];
|
|
2988
|
+
'22': [22, '+', '21', '23', '-22'];
|
|
2989
|
+
'23': [23, '+', '22', '24', '-23'];
|
|
2990
|
+
'24': [24, '+', '23', '25', '-24'];
|
|
2991
|
+
'25': [25, '+', '24', '26', '-25'];
|
|
2992
|
+
'26': [26, '+', '25', '27', '-26'];
|
|
2993
|
+
'27': [27, '+', '26', '28', '-27'];
|
|
2994
|
+
'28': [28, '+', '27', '29', '-28'];
|
|
2995
|
+
'29': [29, '+', '28', '30', '-29'];
|
|
2996
|
+
'30': [30, '+', '29', '31', '-30'];
|
|
2997
|
+
'31': [31, '+', '30', '32', '-31'];
|
|
2998
|
+
'32': [32, '+', '31', '33', '-32'];
|
|
2999
|
+
'33': [33, '+', '32', '34', '-33'];
|
|
3000
|
+
'34': [34, '+', '33', '35', '-34'];
|
|
3001
|
+
'35': [35, '+', '34', '36', '-35'];
|
|
3002
|
+
'36': [36, '+', '35', '37', '-36'];
|
|
3003
|
+
'37': [37, '+', '36', '38', '-37'];
|
|
3004
|
+
'38': [38, '+', '37', '39', '-38'];
|
|
3005
|
+
'39': [39, '+', '38', '40', '-39'];
|
|
3006
|
+
'40': [40, '+', '39', '41', '-40'];
|
|
3007
|
+
'41': [41, '+', '40', '42', '-41'];
|
|
3008
|
+
'42': [42, '+', '41', '43', '-42'];
|
|
3009
|
+
'43': [43, '+', '42', '44', '-43'];
|
|
3010
|
+
'44': [44, '+', '43', '45', '-44'];
|
|
3011
|
+
'45': [45, '+', '44', '46', '-45'];
|
|
3012
|
+
'46': [46, '+', '45', '47', '-46'];
|
|
3013
|
+
'47': [47, '+', '46', '48', '-47'];
|
|
3014
|
+
'48': [48, '+', '47', '49', '-48'];
|
|
3015
|
+
'49': [49, '+', '48', '50', '-49'];
|
|
3016
|
+
'50': [50, '+', '49', '51', '-50'];
|
|
3017
|
+
'51': [51, '+', '50', '52', '-51'];
|
|
3018
|
+
'52': [52, '+', '51', '53', '-52'];
|
|
3019
|
+
'53': [53, '+', '52', '54', '-53'];
|
|
3020
|
+
'54': [54, '+', '53', '55', '-54'];
|
|
3021
|
+
'55': [55, '+', '54', '56', '-55'];
|
|
3022
|
+
'56': [56, '+', '55', '57', '-56'];
|
|
3023
|
+
'57': [57, '+', '56', '58', '-57'];
|
|
3024
|
+
'58': [58, '+', '57', '59', '-58'];
|
|
3025
|
+
'59': [59, '+', '58', '60', '-59'];
|
|
3026
|
+
'60': [60, '+', '59', '61', '-60'];
|
|
3027
|
+
'61': [61, '+', '60', '62', '-61'];
|
|
3028
|
+
'62': [62, '+', '61', '63', '-62'];
|
|
3029
|
+
'63': [63, '+', '62', '64', '-63'];
|
|
3030
|
+
'64': [64, '+', '63', '65', '-64'];
|
|
3031
|
+
'65': [65, '+', '64', '66', '-65'];
|
|
3032
|
+
'66': [66, '+', '65', '67', '-66'];
|
|
3033
|
+
'67': [67, '+', '66', '68', '-67'];
|
|
3034
|
+
'68': [68, '+', '67', '69', '-68'];
|
|
3035
|
+
'69': [69, '+', '68', '70', '-69'];
|
|
3036
|
+
'70': [70, '+', '69', '71', '-70'];
|
|
3037
|
+
'71': [71, '+', '70', '72', '-71'];
|
|
3038
|
+
'72': [72, '+', '71', '73', '-72'];
|
|
3039
|
+
'73': [73, '+', '72', '74', '-73'];
|
|
3040
|
+
'74': [74, '+', '73', '75', '-74'];
|
|
3041
|
+
'75': [75, '+', '74', '76', '-75'];
|
|
3042
|
+
'76': [76, '+', '75', '77', '-76'];
|
|
3043
|
+
'77': [77, '+', '76', '78', '-77'];
|
|
3044
|
+
'78': [78, '+', '77', '79', '-78'];
|
|
3045
|
+
'79': [79, '+', '78', '80', '-79'];
|
|
3046
|
+
'80': [80, '+', '79', '81', '-80'];
|
|
3047
|
+
'81': [81, '+', '80', '82', '-81'];
|
|
3048
|
+
'82': [82, '+', '81', '83', '-82'];
|
|
3049
|
+
'83': [83, '+', '82', '84', '-83'];
|
|
3050
|
+
'84': [84, '+', '83', '85', '-84'];
|
|
3051
|
+
'85': [85, '+', '84', '86', '-85'];
|
|
3052
|
+
'86': [86, '+', '85', '87', '-86'];
|
|
3053
|
+
'87': [87, '+', '86', '88', '-87'];
|
|
3054
|
+
'88': [88, '+', '87', '89', '-88'];
|
|
3055
|
+
'89': [89, '+', '88', '90', '-89'];
|
|
3056
|
+
'90': [90, '+', '89', '91', '-90'];
|
|
3057
|
+
'91': [91, '+', '90', '92', '-91'];
|
|
3058
|
+
'92': [92, '+', '91', '93', '-92'];
|
|
3059
|
+
'93': [93, '+', '92', '94', '-93'];
|
|
3060
|
+
'94': [94, '+', '93', '95', '-94'];
|
|
3061
|
+
'95': [95, '+', '94', '96', '-95'];
|
|
3062
|
+
'96': [96, '+', '95', '97', '-96'];
|
|
3063
|
+
'97': [97, '+', '96', '98', '-97'];
|
|
3064
|
+
'98': [98, '+', '97', '99', '-98'];
|
|
3065
|
+
'99': [99, '+', '98', '100', '-99'];
|
|
3066
|
+
'100': [100, '+', '99', '__', '-100'];
|
|
3067
|
+
};
|
|
2105
3068
|
//#endregion
|
|
2106
|
-
//#region
|
|
2107
|
-
|
|
3069
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/Prev.d.ts
|
|
3070
|
+
/**
|
|
3071
|
+
* Move `I`'s position backwards
|
|
3072
|
+
* @param I to move
|
|
3073
|
+
* @returns [[Iteration]]
|
|
3074
|
+
* @example
|
|
3075
|
+
* ```ts
|
|
3076
|
+
* import {I} from 'ts-toolbelt'
|
|
3077
|
+
*
|
|
3078
|
+
* type i = I.IterationOf<'20'>
|
|
3079
|
+
*
|
|
3080
|
+
* type test0 = I.Pos<i> // 20
|
|
3081
|
+
* type test1 = I.Pos<I.Prev<i>> // 19
|
|
3082
|
+
* ```
|
|
3083
|
+
*/
|
|
3084
|
+
declare type Prev<I$1 extends Iteration> = IterationMap[I$1[2]];
|
|
2108
3085
|
//#endregion
|
|
2109
|
-
//#region
|
|
3086
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/IterationOf.d.ts
|
|
2110
3087
|
/**
|
|
2111
|
-
*
|
|
2112
|
-
*
|
|
3088
|
+
* Transform a number into an [[Iteration]]
|
|
3089
|
+
* (to use [[Prev]], [[Next]], & [[Pos]])
|
|
3090
|
+
* @param N to transform
|
|
3091
|
+
* @returns [[Iteration]]
|
|
3092
|
+
* @example
|
|
3093
|
+
* ```ts
|
|
3094
|
+
* import {I} from 'ts-toolbelt'
|
|
2113
3095
|
*
|
|
2114
|
-
*
|
|
3096
|
+
* type i = I.IterationOf<0> // ["-1", "1", "0", 0, "0"]
|
|
3097
|
+
*
|
|
3098
|
+
* type next = I.Next<i> // ["0", "2", "1", 1, "+"]
|
|
3099
|
+
* type prev = I.Prev<i> // ["-2", "0", "-1", -1, "-"]
|
|
3100
|
+
*
|
|
3101
|
+
* type nnext = I.Pos<next> // +1
|
|
3102
|
+
* type nprev = I.Pos<prev> // -1
|
|
3103
|
+
* ```
|
|
2115
3104
|
*/
|
|
2116
|
-
declare
|
|
3105
|
+
declare type IterationOf<N extends number> = `${N}` extends keyof IterationMap ? IterationMap[`${N}`] : IterationMap['__'];
|
|
2117
3106
|
//#endregion
|
|
2118
|
-
//#region
|
|
3107
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/Pos.d.ts
|
|
3108
|
+
/**
|
|
3109
|
+
* Get the position of `I` (**number**)
|
|
3110
|
+
* @param I to query
|
|
3111
|
+
* @returns `number`
|
|
3112
|
+
* @example
|
|
3113
|
+
* ```ts
|
|
3114
|
+
* import {I} from 'ts-toolbelt'
|
|
3115
|
+
*
|
|
3116
|
+
* type i = I.IterationOf<'20'>
|
|
3117
|
+
*
|
|
3118
|
+
* type test0 = I.Pos<i> // 20
|
|
3119
|
+
* type test1 = I.Pos<I.Next<i>> // 21
|
|
3120
|
+
* ```
|
|
3121
|
+
*/
|
|
3122
|
+
declare type Pos<I$1 extends Iteration> = I$1[0];
|
|
3123
|
+
//#endregion
|
|
3124
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Tail.d.ts
|
|
3125
|
+
/**
|
|
3126
|
+
* Remove the first item out of a [[List]]
|
|
3127
|
+
* @param L
|
|
3128
|
+
* @returns [[List]]
|
|
3129
|
+
* @example
|
|
3130
|
+
* ```ts
|
|
3131
|
+
* ```
|
|
3132
|
+
*/
|
|
3133
|
+
declare type Tail$1<L$1 extends List> = L$1 extends readonly [] ? L$1 : L$1 extends readonly [any?, ...infer LTail] ? LTail : L$1;
|
|
3134
|
+
//#endregion
|
|
3135
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Union/IntersectOf.d.ts
|
|
3136
|
+
/**
|
|
3137
|
+
* Transform a [[Union]] to an * *intersection**
|
|
3138
|
+
* @param U to transform
|
|
3139
|
+
* @returns `&`
|
|
3140
|
+
* @example
|
|
3141
|
+
* ```ts
|
|
3142
|
+
* ```
|
|
3143
|
+
*/
|
|
3144
|
+
declare type IntersectOf<U$1 extends any> = (U$1 extends unknown ? (k: U$1) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
3145
|
+
//#endregion
|
|
3146
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Object/Overwrite.d.ts
|
|
3147
|
+
/**
|
|
3148
|
+
* Update the fields of `O` with the ones of `O1`
|
|
3149
|
+
* (only the existing fields will be updated)
|
|
3150
|
+
* @param O to update
|
|
3151
|
+
* @param O1 to update with
|
|
3152
|
+
* @returns [[Object]]
|
|
3153
|
+
* @example
|
|
3154
|
+
* ```ts
|
|
3155
|
+
* ```
|
|
3156
|
+
*/
|
|
3157
|
+
declare type Overwrite<O extends object, O1 extends object> = { [K in keyof O]: K extends keyof O1 ? O1[K] : O[K] } & {};
|
|
3158
|
+
//#endregion
|
|
3159
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/_Internal.d.ts
|
|
3160
|
+
/**
|
|
3161
|
+
* Remove `?` & `readonly` from a [[List]]
|
|
3162
|
+
*/
|
|
3163
|
+
declare type Naked<L$1 extends List> = Overwrite<Required<L$1>, L$1>;
|
|
3164
|
+
//#endregion
|
|
3165
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Prepend.d.ts
|
|
3166
|
+
/**
|
|
3167
|
+
* Add an element `A` at the beginning of `L`
|
|
3168
|
+
* @param L to append to
|
|
3169
|
+
* @param A to be added to
|
|
3170
|
+
* @returns [[List]]
|
|
3171
|
+
* @example
|
|
3172
|
+
* ```ts
|
|
3173
|
+
* ```
|
|
3174
|
+
*/
|
|
3175
|
+
declare type Prepend<L$1 extends List, A$1 extends any> = [A$1, ...L$1];
|
|
3176
|
+
//#endregion
|
|
3177
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/_Internal.d.ts
|
|
3178
|
+
/**
|
|
3179
|
+
* Describes how to perform iterations
|
|
3180
|
+
*/
|
|
3181
|
+
declare type Way = '->' | '<-';
|
|
3182
|
+
//#endregion
|
|
3183
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Append.d.ts
|
|
3184
|
+
/**
|
|
3185
|
+
* Add an element `A` at the end of `L`.
|
|
3186
|
+
* @param L to append to
|
|
3187
|
+
* @param A to be added to
|
|
3188
|
+
* @returns [[List]]
|
|
3189
|
+
* @example
|
|
3190
|
+
* ```ts
|
|
3191
|
+
* import {L} from 'ts-toolbelt'
|
|
3192
|
+
*
|
|
3193
|
+
* type test0 = L.Append<[1, 2, 3], 4> // [1, 2, 3, 4]
|
|
3194
|
+
* type test1 = L.Append<[], 'a'> // ['a']
|
|
3195
|
+
* type test2 = L.Append<readonly ['a', 'b'], 'c'> // ['a', 'b', 'c']
|
|
3196
|
+
* type test3 = L.Append<[1, 2], [3, 4]> // [1, 2, [3, 4]]
|
|
3197
|
+
* ```
|
|
3198
|
+
*/
|
|
3199
|
+
declare type Append<L$1 extends List, A$1 extends any> = [...L$1, A$1];
|
|
3200
|
+
//#endregion
|
|
3201
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Object/Record.d.ts
|
|
3202
|
+
/**
|
|
3203
|
+
* Create an object filled with `A` for the fields `K`
|
|
3204
|
+
* @param K to choose fields
|
|
3205
|
+
* @param A (?=`unknown`) to fill fields with
|
|
3206
|
+
* @param modx (?=`['!', 'W']`) to set modifiers
|
|
3207
|
+
* @returns [[Object]]
|
|
3208
|
+
* @example
|
|
3209
|
+
* ```ts
|
|
3210
|
+
* ```
|
|
3211
|
+
*/
|
|
3212
|
+
declare type Record$1<K$1 extends Key$1, A$1 extends any = unknown, modx extends Modx = ['!', 'W']> = {
|
|
3213
|
+
'!': {
|
|
3214
|
+
'R': { readonly [P in K$1]: A$1 };
|
|
3215
|
+
'W': { [P in K$1]: A$1 };
|
|
3216
|
+
};
|
|
3217
|
+
'?': {
|
|
3218
|
+
'R': { readonly [P in K$1]?: A$1 };
|
|
3219
|
+
'W': { [P in K$1]?: A$1 };
|
|
3220
|
+
};
|
|
3221
|
+
}[modx[0]][modx[1]];
|
|
3222
|
+
//#endregion
|
|
3223
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Object/Invert.d.ts
|
|
3224
|
+
/**
|
|
3225
|
+
* @hidden
|
|
3226
|
+
*/
|
|
3227
|
+
declare type _Invert<O extends Record$1<Key$1, Key$1>> = ComputeRaw<IntersectOf<{ [K in keyof O]: Record$1<O[K], K> }[keyof O]>>;
|
|
3228
|
+
/**
|
|
3229
|
+
* Swaps the keys and values of an [[Object]] (if applicable)
|
|
3230
|
+
* @param O
|
|
3231
|
+
* @returns [[Object]]
|
|
3232
|
+
* @example
|
|
3233
|
+
* ```ts
|
|
3234
|
+
* import {O} from 'ts-toolbelt'
|
|
3235
|
+
*
|
|
3236
|
+
* enum E {
|
|
3237
|
+
* A = 'Av',
|
|
3238
|
+
* B = 'Bv',
|
|
3239
|
+
* C = 'Cv',
|
|
3240
|
+
* D = 'Dv',
|
|
3241
|
+
* X = 1
|
|
3242
|
+
* }
|
|
3243
|
+
*
|
|
3244
|
+
* type O = {
|
|
3245
|
+
* A: 'Av'
|
|
3246
|
+
* B: 'Bv'
|
|
3247
|
+
* C: 'Cv'
|
|
3248
|
+
* D: 'Dv'
|
|
3249
|
+
* X: 1
|
|
3250
|
+
* }
|
|
3251
|
+
*
|
|
3252
|
+
* type test0 = O.Invert<typeof E>
|
|
3253
|
+
* type test1 = O.Invert<O>
|
|
3254
|
+
* ```
|
|
3255
|
+
*/
|
|
3256
|
+
declare type Invert<O extends Record$1<keyof O, Key$1>> = O extends unknown ? _Invert<O> : never;
|
|
3257
|
+
//#endregion
|
|
3258
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Drop.d.ts
|
|
3259
|
+
/**
|
|
3260
|
+
* @hidden
|
|
3261
|
+
*/
|
|
3262
|
+
declare type DropForth<L$1 extends List, N extends Iteration> = {
|
|
3263
|
+
0: DropForth<Tail$1<L$1>, Prev<N>>;
|
|
3264
|
+
1: L$1;
|
|
3265
|
+
}[Extends<0, Pos<N>>];
|
|
3266
|
+
/**
|
|
3267
|
+
* @hidden
|
|
3268
|
+
*/
|
|
3269
|
+
declare type DropBack<L$1 extends List, N extends Iteration, I$1 extends Iteration = Prev<N>, LN extends List = []> = {
|
|
3270
|
+
0: DropBack<L$1, N, Prev<I$1>, Prepend<LN, L$1[Pos<I$1>]>>;
|
|
3271
|
+
1: LN;
|
|
3272
|
+
}[Extends<-1, Pos<I$1>>];
|
|
3273
|
+
/**
|
|
3274
|
+
* @hidden
|
|
3275
|
+
*/
|
|
3276
|
+
declare type __Drop<L$1 extends List, N extends Iteration, way extends Way> = {
|
|
3277
|
+
'->': DropForth<L$1, N>;
|
|
3278
|
+
'<-': DropBack<L$1, N>;
|
|
3279
|
+
}[way];
|
|
3280
|
+
/**
|
|
3281
|
+
* @hidden
|
|
3282
|
+
*/
|
|
3283
|
+
declare type _Drop<L$1 extends List, N extends number, way extends Way = '->'> = __Drop<Naked<L$1>, IterationOf<N>, way> extends infer X ? Cast<X, List> : never;
|
|
3284
|
+
/**
|
|
3285
|
+
* Remove `N` entries out of `L`
|
|
3286
|
+
* @param L to remove from
|
|
3287
|
+
* @param N to remove out
|
|
3288
|
+
* @param way (?=`'->'`) from front: '->', from end: '<-'
|
|
3289
|
+
* @returns [[List]]
|
|
3290
|
+
* @example
|
|
3291
|
+
* ```ts
|
|
3292
|
+
* ```
|
|
3293
|
+
*/
|
|
3294
|
+
declare type Drop<L$1 extends List, N extends number, way extends Way = '->'> = L$1 extends unknown ? N extends unknown ? _Drop<L$1, N, way> : never : never;
|
|
3295
|
+
//#endregion
|
|
3296
|
+
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Take.d.ts
|
|
3297
|
+
/**
|
|
3298
|
+
* starts in reverse from `N` till `N` = 0
|
|
3299
|
+
* @hidden
|
|
3300
|
+
*/
|
|
3301
|
+
declare type TakeForth<L$1 extends List, N extends Iteration, I$1 extends Iteration = Prev<N>, LN extends List = []> = {
|
|
3302
|
+
0: TakeForth<L$1, N, Prev<I$1>, Prepend<LN, L$1[Pos<I$1>]>>;
|
|
3303
|
+
1: LN;
|
|
3304
|
+
}[Extends<-1, Pos<I$1>>];
|
|
3305
|
+
/**
|
|
3306
|
+
* starts in reverse from the end till `N` = 0
|
|
3307
|
+
* @hidden
|
|
3308
|
+
*/
|
|
3309
|
+
declare type TakeBack<L$1 extends List, N extends Iteration> = {
|
|
3310
|
+
0: TakeBack<Tail$1<L$1>, Prev<N>>;
|
|
3311
|
+
1: L$1;
|
|
3312
|
+
}[Extends<0, Pos<N>>];
|
|
3313
|
+
/**
|
|
3314
|
+
* @hidden
|
|
3315
|
+
*/
|
|
3316
|
+
declare type __Take<L$1 extends List, N extends Iteration, way extends Way> = {
|
|
3317
|
+
'->': TakeForth<L$1, N>;
|
|
3318
|
+
'<-': TakeBack<L$1, N>;
|
|
3319
|
+
}[way];
|
|
2119
3320
|
/**
|
|
2120
|
-
*
|
|
3321
|
+
* @hidden
|
|
3322
|
+
*/
|
|
3323
|
+
declare type _Take<L$1 extends List, N extends number, way extends Way = '->'> = __Take<L$1, IterationOf<N>, way> extends infer X ? Cast<X, List> : never;
|
|
3324
|
+
/**
|
|
3325
|
+
* Extract `N` entries out of `L`
|
|
3326
|
+
* @param L to extract from
|
|
3327
|
+
* @param N to extract out
|
|
3328
|
+
* @param way (?=`'->'`) to extract from end
|
|
3329
|
+
* @returns [[List]]
|
|
3330
|
+
* @example
|
|
3331
|
+
* ```ts
|
|
3332
|
+
* ```
|
|
3333
|
+
*/
|
|
3334
|
+
declare type Take<L$1 extends List, N extends number, way extends Way = '->'> = L$1 extends unknown ? N extends unknown ? _Take<L$1, N, way> : never : never;
|
|
3335
|
+
//#endregion
|
|
3336
|
+
//#region src/types/index.type.d.ts
|
|
3337
|
+
type AnyArray<A$1 = any> = readonly A$1[];
|
|
3338
|
+
type Range<Start extends number, End extends number> = Exclude<keyof TupleOf<End>, keyof TupleOf<Start>>;
|
|
3339
|
+
type TupleToEntries<A$1 extends readonly unknown[]> = If<IsAny<A$1>, unknown, { [Key in keyof A$1]: [Key, A$1[Key]] }>;
|
|
3340
|
+
type Groups<L$1 extends AnyArray, LN extends AnyArray = [], D extends number[] = []> = D["length"] extends 40 ? LN : {
|
|
3341
|
+
0: Groups<Drop<L$1, 1>, Append<LN, [`${LN["length"]}`, Take<L$1, 1>]>, [...D, 0]>;
|
|
3342
|
+
1: LN;
|
|
3343
|
+
}[Extends<L$1, AnyArray<never>>];
|
|
3344
|
+
type TupleToGroups<L$1 extends AnyArray> = Groups<L$1> extends infer X ? Cast<X, AnyArray> : never;
|
|
3345
|
+
//#endregion
|
|
3346
|
+
//#region src/utils/object/objectEntries.d.ts
|
|
3347
|
+
/**
|
|
3348
|
+
* 返回对象的可枚举属性的键/值数组
|
|
3349
|
+
*/
|
|
3350
|
+
declare function objectEntries<const S extends string>(string: S): TupleToEntries<Split<S, "">>;
|
|
3351
|
+
declare function objectEntries<const A$1 extends readonly unknown[]>(array: A$1): TupleToGroups<A$1>;
|
|
3352
|
+
declare function objectEntries<const O extends PlainObject>(plainObject: O): [string & keyof O, O[keyof O]][];
|
|
3353
|
+
declare function objectEntries<const O extends AnyObject>(anyObject: O): [string & keyof O, O[keyof O]][];
|
|
3354
|
+
//#endregion
|
|
3355
|
+
//#region src/utils/object/objectInvert.d.ts
|
|
3356
|
+
/**
|
|
3357
|
+
* 尽可能地交换对象的键和值
|
|
2121
3358
|
*
|
|
2122
3359
|
* @param obj 对象
|
|
2123
3360
|
*/
|
|
2124
|
-
declare function
|
|
3361
|
+
declare function objectInvert<const O extends Record<keyof O, PropertyKey>>(plainObject: O): Invert<O>;
|
|
3362
|
+
declare function objectInvert<const O extends AnyObject>(anyObject: O): Invert<O>;
|
|
3363
|
+
//#endregion
|
|
3364
|
+
//#region src/utils/object/objectKeys.d.ts
|
|
3365
|
+
/**
|
|
3366
|
+
* 返回对象可枚举属性和方法的名称
|
|
3367
|
+
* - `Object.keys` 始终返回 `string[]` 类型,此函数可以返回具体类型
|
|
3368
|
+
*/
|
|
3369
|
+
declare function objectKeys<const S extends string>(string: S): UnionToTuple<Range<0, Split<S, "">["length"]>>;
|
|
3370
|
+
declare function objectKeys<const A$1 extends ArrayLike<unknown>>(array: A$1): UnionToTuple<Range<0, A$1["length"]>>;
|
|
3371
|
+
declare function objectKeys<O extends PlainObject>(plainObject: O): `${Extract<keyof O, string | number>}`[];
|
|
3372
|
+
declare function objectKeys<O extends AnyObject>(anyObject: O): `${Extract<keyof O, string | number>}`[];
|
|
3373
|
+
//#endregion
|
|
3374
|
+
//#region src/utils/object/objectPick.d.ts
|
|
3375
|
+
declare function objectPick<O extends PlainObject, K$1 extends keyof O>(plainObject: O, keys: readonly K$1[]): Pick<O, K$1>;
|
|
3376
|
+
declare function objectPick<O extends AnyObject, K$1 extends keyof O>(anyObject: O, keys: readonly K$1[]): Pick<O, K$1>;
|
|
3377
|
+
//#endregion
|
|
3378
|
+
//#region src/utils/object/objectValues.d.ts
|
|
3379
|
+
/**
|
|
3380
|
+
* 返回对象可枚举属性的值的数组
|
|
3381
|
+
*/
|
|
3382
|
+
declare function objectValues<S extends string>(string: S): Split<S, "">;
|
|
3383
|
+
declare function objectValues<A$1 extends ArrayLike<unknown>>(array: A$1): A$1;
|
|
3384
|
+
declare function objectValues<O extends PlainObject>(plainObject: O): UnionToTuple<ValueOf<O>>;
|
|
3385
|
+
declare function objectValues<O extends AnyObject>(anyObject: O): UnionToTuple<ValueOf<O>>;
|
|
2125
3386
|
//#endregion
|
|
2126
3387
|
//#region src/utils/string/stringInitialCase.d.ts
|
|
2127
3388
|
/**
|
|
@@ -2291,6 +3552,7 @@ declare function isBigInt(value: unknown): value is bigint;
|
|
|
2291
3552
|
//#endregion
|
|
2292
3553
|
//#region src/utils/typeof/isBlob.d.ts
|
|
2293
3554
|
declare function isBlob(value: unknown): value is Blob;
|
|
3555
|
+
declare function isFile(value: unknown): value is File;
|
|
2294
3556
|
//#endregion
|
|
2295
3557
|
//#region src/utils/typeof/isBoolean.d.ts
|
|
2296
3558
|
declare function isBoolean(value: unknown): value is boolean;
|
|
@@ -2301,6 +3563,17 @@ declare function isClass(value: unknown): value is Class<AnyObject>;
|
|
|
2301
3563
|
//#region src/utils/typeof/isDate.d.ts
|
|
2302
3564
|
declare function isDate(value: unknown): value is Date;
|
|
2303
3565
|
//#endregion
|
|
3566
|
+
//#region src/utils/typeof/isEnumeration.d.ts
|
|
3567
|
+
/**
|
|
3568
|
+
* 判断一个值是否为有效的枚举对象
|
|
3569
|
+
* - 枚举不能为空
|
|
3570
|
+
* - 枚举所有的值必须是 string 或 number
|
|
3571
|
+
*
|
|
3572
|
+
* @param obj
|
|
3573
|
+
* @returns
|
|
3574
|
+
*/
|
|
3575
|
+
declare function isEnumeration(obj: unknown): [boolean, boolean];
|
|
3576
|
+
//#endregion
|
|
2304
3577
|
//#region src/utils/typeof/isEqual.d.ts
|
|
2305
3578
|
/**
|
|
2306
3579
|
* 检查给定的值是否相等
|
|
@@ -2318,9 +3591,6 @@ declare function isError(value: unknown): value is Error;
|
|
|
2318
3591
|
declare function isFalsy(value: unknown): boolean;
|
|
2319
3592
|
declare function isFalsyLike(value: unknown): boolean;
|
|
2320
3593
|
//#endregion
|
|
2321
|
-
//#region src/utils/typeof/isFile.d.ts
|
|
2322
|
-
declare function isFile(value: unknown): value is File;
|
|
2323
|
-
//#endregion
|
|
2324
3594
|
//#region src/utils/typeof/isFunction.d.ts
|
|
2325
3595
|
declare function isFunction(value: unknown): value is AnyFunction;
|
|
2326
3596
|
declare function isAsyncFunction(value: unknown): value is AnyAsyncFunction;
|
|
@@ -2448,5 +3718,5 @@ declare function isWebSocket(value: unknown): value is WebSocket;
|
|
|
2448
3718
|
//#region src/utils/typeof/isWindow.d.ts
|
|
2449
3719
|
declare function isWindow(value: unknown): value is Window;
|
|
2450
3720
|
//#endregion
|
|
2451
|
-
export { arrayCast, arrayCompete, arrayCounting, arrayDifference, arrayFirst, arrayFork, arrayIntersection, arrayLast, arrayMerge, arrayPick, arrayReplace, arraySplit, cloneDeep, enumEntries, enumKeys,
|
|
3721
|
+
export { arrayCast, arrayCompete, arrayCounting, arrayDifference, arrayFirst, arrayFork, arrayIntersection, arrayLast, arrayMerge, arrayPick, arrayReplace, arraySplit, cloneDeep, enumEntries, enumKeys, enumValues, getTimeZone, isAbortSignal, isArray, isAsyncFunction, isAsyncGeneratorFunction, isBigInt, isBlob, isBoolean, isClass, isDate, isEnumeration, isEqual, isError, isFalsy, isFalsyLike, isFile, isFunction, isGeneratorFunction, isISOMobile, isInfinity, isInfinityLike, isInteger, isIterable, isMap, isMobile, isNaN, isNegativeInteger, isNull, isNumber, isObject, isPositiveInteger, isPromise, isPromiseLike, isReadableStream, isRegExp, isSet, isString, isSymbol, isTablet, isTypedArray, isURLSearchParams, isUndefined, isWeakMap, isWeakSet, isWebSocket, isWindow, mapEntries, objectAssign, objectCrush, objectEntries, objectInvert, objectKeys, objectPick, objectValues, rowsToTree, stringInitialCase, stringReplace, stringTemplate, stringToJson, stringToNumber, stringToPosix, stringToValues, stringTrim, stringTruncate, to, toMathBignumber, toMathDecimal, toMathEvaluate, treeFilter, treeFind, treeForEach, treeMap, treeToRows };
|
|
2452
3722
|
//# sourceMappingURL=index.d.ts.map
|