@pawover/kit 0.0.1 → 0.1.0

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.
@@ -13,11 +13,16 @@ declare class ArrayUtil {
13
13
  * @returns 构造后的数组
14
14
  * @example
15
15
  * ```ts
16
+ * // 重载 1: checkEmpty = true (默认)
16
17
  * ArrayUtil.cast(1); // [1]
17
- * ArrayUtil.cast([1, 2]); // [1, 2]
18
18
  * ArrayUtil.cast(null); // []
19
- * ArrayUtil.cast(undefined); // []
19
+ *
20
+ * // 重载 2: checkEmpty = false
20
21
  * ArrayUtil.cast(null, false); // [null]
22
+ *
23
+ * // 通用场景
24
+ * ArrayUtil.cast([1, 2]); // [1, 2]
25
+ * ArrayUtil.cast(undefined); // []
21
26
  * ```
22
27
  */
23
28
  static cast<T>(candidate: T | T[] | null | undefined, checkEmpty?: true): NonNullable<T>[];
@@ -30,7 +35,11 @@ declare class ArrayUtil {
30
35
  * @returns 数组第一项,如果为空则返回回退值
31
36
  * @example
32
37
  * ```ts
38
+ * // 重载 1: 无 fallback
33
39
  * ArrayUtil.first([1, 2]); // 1
40
+ * ArrayUtil.first([]); // undefined
41
+ *
42
+ * // 重载 2: 有 fallback
34
43
  * ArrayUtil.first([], 0); // 0
35
44
  * ```
36
45
  */
@@ -44,7 +53,11 @@ declare class ArrayUtil {
44
53
  * @returns 数组最后一项,如果为空则返回回退值
45
54
  * @example
46
55
  * ```ts
56
+ * // 重载 1: 无 fallback
47
57
  * ArrayUtil.last([1, 2, 3]); // 3
58
+ * ArrayUtil.last([]); // undefined
59
+ *
60
+ * // 重载 2: 有 fallback
48
61
  * ArrayUtil.last([], 0); // 0
49
62
  * ```
50
63
  */
@@ -107,7 +120,10 @@ declare class ArrayUtil {
107
120
  * @returns 交集数组
108
121
  * @example
109
122
  * ```ts
123
+ * // 重载 1: 按元素本身比较
110
124
  * ArrayUtil.intersection([1, 2], [2, 3]); // [2]
125
+ *
126
+ * // 重载 2: 按 match 结果比较
111
127
  * ArrayUtil.intersection([{ id: 1 }, { id: 2 }], [{ id: 2 }], (x) => x.id); // [{ id: 2 }]
112
128
  * ```
113
129
  */
@@ -124,11 +140,11 @@ declare class ArrayUtil {
124
140
  * @returns 合并后的数组
125
141
  * @example
126
142
  * ```ts
127
- * // 基础合并去重
143
+ * // 重载 1: 基础合并去重
128
144
  * ArrayUtil.merge([1, 2], [2, 3]); // [1, 2, 3]
129
145
  * ArrayUtil.merge([], [1, 2, 3]); // [1, 2, 3]
130
146
  *
131
- * // 按条件更新
147
+ * // 重载 2: 按条件更新
132
148
  * const source = [{ id: 1, val: "a" }, { id: 2, val: "b" }];
133
149
  * const update = [{ id: 2, val: "new" }, { id: 3, val: "c" }];
134
150
  * ArrayUtil.merge(source, update, (x) => x.id); // [{ id: 1, val: "a" }, { id: 2, val: "new" }] -> id:3 被忽略
@@ -147,7 +163,11 @@ declare class ArrayUtil {
147
163
  * @example
148
164
  * ```ts
149
165
  * const list = [1, 2, 3, 4];
166
+ *
167
+ * // 重载 1: 仅过滤
150
168
  * ArrayUtil.pick(list, (n) => n % 2 === 0); // [2, 4]
169
+ *
170
+ * // 重载 2: 过滤 + 映射
151
171
  * ArrayUtil.pick(list, (n) => n % 2 === 0, (n) => n * 2); // [4, 8]
152
172
  * ```
153
173
  */
@@ -164,7 +184,11 @@ declare class ArrayUtil {
164
184
  * @returns 替换后的新数组
165
185
  * @example
166
186
  * ```ts
187
+ * // 重载 1/2: newItem 与数组元素类型兼容
167
188
  * ArrayUtil.replace([1, 2, 3], 4, (n) => n === 2); // [1, 4, 3]
189
+ *
190
+ * // 重载 3: newItem 可扩展为新类型
191
+ * ArrayUtil.replace([1, 2, 3], "X", (n) => n === 2); // [1, "X", 3]
168
192
  * ```
169
193
  */
170
194
  static replace<const T>(initialList: readonly T[], newItem: T, match: MatchFunction<T, boolean>): T[];
@@ -236,7 +260,20 @@ declare class ArrayUtil {
236
260
  * @returns 压缩后的元组数组
237
261
  * @example
238
262
  * ```ts
263
+ * // 重载 1: 两个数组
239
264
  * ArrayUtil.zip([1, 2], ["a", "b"]); // [[1, "a"], [2, "b"]]
265
+ *
266
+ * // 重载 2: 三个数组
267
+ * ArrayUtil.zip([1, 2], ["a", "b"], [true, false]); // [[1, "a", true], [2, "b", false]]
268
+ *
269
+ * // 重载 3: 四个数组
270
+ * ArrayUtil.zip([1], ["a"], [true], ["x"]); // [[1, "a", true, "x"]]
271
+ *
272
+ * // 重载 4: 五个数组
273
+ * ArrayUtil.zip([1], ["a"], [true], ["x"], [9]); // [[1, "a", true, "x", 9]]
274
+ *
275
+ * // 重载 5: 空参数
276
+ * ArrayUtil.zip(); // []
240
277
  * ```
241
278
  */
242
279
  static zip<T1, T2, T3, T4, T5>(array1: readonly T1[], array2: readonly T2[], array3: readonly T3[], array4: readonly T4[], array5: readonly T5[]): [T1, T2, T3, T4, T5][];
@@ -253,8 +290,13 @@ declare class ArrayUtil {
253
290
  * @returns 生成的对象
254
291
  * @example
255
292
  * ```ts
293
+ * // 重载 1: 传值数组
256
294
  * ArrayUtil.zipToObject(["a", "b"], [1, 2]); // { a: 1, b: 2 }
295
+ *
296
+ * // 重载 2: 传生成函数
257
297
  * ArrayUtil.zipToObject(["a", "b"], (k, i) => k + i); // { a: "a0", b: "b1" }
298
+ *
299
+ * // 重载 3: 传静态值
258
300
  * ArrayUtil.zipToObject(["a", "b"], 1); // { a: 1, b: 1 }
259
301
  * ```
260
302
  */
@@ -270,52 +312,109 @@ declare class ArrayUtil {
270
312
  declare class DateTimeUtil {
271
313
  /**
272
314
  * 每秒的毫秒数
315
+ * @example
316
+ * ```ts
317
+ * DateTimeUtil.MILLISECONDS_PER_SECOND; // 1000
318
+ * ```
273
319
  */
274
320
  static readonly MILLISECONDS_PER_SECOND: number;
275
321
  /**
276
322
  * 每分钟的秒数
323
+ * @example
324
+ * ```ts
325
+ * DateTimeUtil.SECOND_PER_MINUTE; // 60
326
+ * ```
277
327
  */
278
328
  static readonly SECOND_PER_MINUTE: number;
279
329
  /**
280
330
  * 每小时的分钟数
331
+ * @example
332
+ * ```ts
333
+ * DateTimeUtil.MINUTE_PER_HOUR; // 60
334
+ * ```
281
335
  */
282
336
  static readonly MINUTE_PER_HOUR: number;
283
337
  /**
284
338
  * 每小时的秒数
339
+ * @example
340
+ * ```ts
341
+ * DateTimeUtil.SECOND_PER_HOUR; // 3600
342
+ * ```
285
343
  */
286
344
  static readonly SECOND_PER_HOUR: number;
287
345
  /**
288
346
  * 每天小时数
347
+ * @example
348
+ * ```ts
349
+ * DateTimeUtil.HOUR_PER_DAY; // 24
350
+ * ```
289
351
  */
290
352
  static readonly HOUR_PER_DAY: number;
291
353
  /**
292
354
  * 每天秒数
355
+ * @example
356
+ * ```ts
357
+ * DateTimeUtil.SECOND_PER_DAY; // 86400
358
+ * ```
293
359
  */
294
360
  static readonly SECOND_PER_DAY: number;
295
361
  /**
296
362
  * 每周天数
363
+ * @example
364
+ * ```ts
365
+ * DateTimeUtil.DAY_PER_WEEK; // 7
366
+ * ```
297
367
  */
298
368
  static readonly DAY_PER_WEEK: number;
299
369
  /**
300
370
  * 每月天数
371
+ * @example
372
+ * ```ts
373
+ * DateTimeUtil.DAY_PER_MONTH; // 30
374
+ * ```
301
375
  */
302
376
  static readonly DAY_PER_MONTH: number;
303
377
  /**
304
378
  * 每年天数
379
+ * @example
380
+ * ```ts
381
+ * DateTimeUtil.DAY_PER_YEAR; // 365
382
+ * ```
305
383
  */
306
384
  static readonly DAY_PER_YEAR: number;
307
385
  /**
308
386
  * 每年月数
387
+ * @example
388
+ * ```ts
389
+ * DateTimeUtil.MONTH_PER_YEAR; // 12
390
+ * ```
309
391
  */
310
392
  static readonly MONTH_PER_YEAR: number;
311
393
  /**
312
394
  * 每年平均周
395
+ * @example
396
+ * ```ts
397
+ * DateTimeUtil.WEEK_PER_YEAR; // 52
398
+ * ```
313
399
  */
314
400
  static readonly WEEK_PER_YEAR: number;
315
401
  /**
316
402
  * 每月平均周
403
+ * @example
404
+ * ```ts
405
+ * DateTimeUtil.WEEK_PER_MONTH; // 4
406
+ * ```
317
407
  */
318
408
  static readonly WEEK_PER_MONTH: number;
409
+ /**
410
+ * 常用时间格式模板集合
411
+ *
412
+ * @example
413
+ * ```ts
414
+ * DateTimeUtil.FORMAT.ISO_DATE; // "yyyy-MM-dd"
415
+ * DateTimeUtil.FORMAT.CN_DATE_TIME; // "yyyy年MM月dd日 HH时mm分ss秒"
416
+ * ```
417
+ */
319
418
  static readonly FORMAT: {
320
419
  readonly ISO_DATE: "yyyy-MM-dd";
321
420
  readonly ISO_TIME: "HH:mm:ss";
@@ -372,11 +471,44 @@ declare class EnvUtil {
372
471
  private static readonly _isBrowser;
373
472
  private static readonly _isWebWorker;
374
473
  private static readonly _isReactNative;
474
+ /**
475
+ * 检测是否处于浏览器环境
476
+ *
477
+ * @returns 是否为浏览器环境
478
+ * @example
479
+ * ```ts
480
+ * EnvUtil.isBrowser(); // true: 浏览器, false: Node.js
481
+ * ```
482
+ */
375
483
  static isBrowser(): boolean;
484
+ /**
485
+ * 检测是否处于 Web Worker 环境
486
+ *
487
+ * @returns 是否为 Web Worker 环境
488
+ * @example
489
+ * ```ts
490
+ * EnvUtil.isWebWorker(); // true: Worker, false: 主线程/Node.js
491
+ * ```
492
+ */
376
493
  static isWebWorker(): boolean;
494
+ /**
495
+ * 检测是否处于 React Native 环境
496
+ *
497
+ * @returns 是否为 React Native 环境
498
+ * @example
499
+ * ```ts
500
+ * EnvUtil.isReactNative(); // true: React Native, false: Web/Node.js
501
+ * ```
502
+ */
377
503
  static isReactNative(): boolean;
378
504
  /**
379
505
  * 检查是否在 iframe 环境中
506
+ *
507
+ * @returns 是否在 iframe 中
508
+ * @example
509
+ * ```ts
510
+ * EnvUtil.isIframe(); // true: 当前页面在 iframe 中
511
+ * ```
380
512
  */
381
513
  static isIframe(): boolean;
382
514
  /**
@@ -466,9 +598,9 @@ declare class EnvUtil {
466
598
  static isTablet(minWidth?: number, maxWidth?: number, dpi?: number): boolean;
467
599
  }
468
600
  //#endregion
469
- //#region ../../node_modules/.pnpm/@pawover+types@0.0.1_@types+react@19.2.14_typescript@6.0.3/node_modules/@pawover/types/dist/index.d.ts
601
+ //#region ../../node_modules/.pnpm/@pawover+types@0.0.2_@types+react@19.2.15_typescript@6.0.3/node_modules/@pawover/types/dist/index.d.ts
470
602
  //#endregion
471
- //#region src/index.d.ts
603
+ //#region src/global.d.ts
472
604
  /** 任意对象类型 */
473
605
  type AnyObject<K extends PropertyKey = PropertyKey, T = any> = Record<K, T>;
474
606
  /** 普通对象类型 */
@@ -482,7 +614,8 @@ type AnyAsyncFunction<P extends any[] = any[], R = any> = (...args: P) => Promis
482
614
  /** 描述生成器函数类型 */
483
615
  type AnyGeneratorFunction<P extends any[] = any[], T = any, R = any, N = any> = (...args: P) => Generator<T, R, N>;
484
616
  /** 描述异步生成器函数类型 */
485
- type AnyAsyncGeneratorFunction<P extends any[] = any[], T = any, R = any, N = any> = (...args: P) => AsyncGenerator<T, R, N>; //#endregion
617
+ type AnyAsyncGeneratorFunction<P extends any[] = any[], T = any, R = any, N = any> = (...args: P) => AsyncGenerator<T, R, N>;
618
+ /** 描述无返回值函数 */
486
619
  //#endregion
487
620
  //#region src/function/functionUtil.d.ts
488
621
  /**
@@ -514,6 +647,7 @@ declare class FunctionUtil {
514
647
  * @throws TypeError 如果 args 为 null 或 undefined
515
648
  *
516
649
  * @example
650
+ * ```ts
517
651
  * // 遗留代码场景
518
652
  * function legacyFn(a: number, b: string) {
519
653
  * const argsArray = FunctionUtil.toArgs(arguments);
@@ -530,6 +664,7 @@ declare class FunctionUtil {
530
664
  * const rest = FunctionUtil.toArgs(arguments, 1);
531
665
  * // rest: unknown[],跳过第一个参数
532
666
  * }
667
+ * ```
533
668
  */
534
669
  static toArgs<T = unknown>(args: IArguments, start?: number | undefined): T[];
535
670
  /**
@@ -540,6 +675,7 @@ declare class FunctionUtil {
540
675
  * @returns 标准化的 Promise
541
676
  *
542
677
  * @example
678
+ * ```ts
543
679
  * // 同步函数
544
680
  * FunctionUtil.toPromise(() => 42).then(v => console.log(v)); // 42
545
681
  *
@@ -548,6 +684,7 @@ declare class FunctionUtil {
548
684
  *
549
685
  * // 异常处理
550
686
  * FunctionUtil.toPromise(() => { throw new Error('fail'); }).catch(err => console.error(err)); // 捕获同步异常
687
+ * ```
551
688
  */
552
689
  static toPromise<T>(fn: () => T | Promise<T>): Promise<T>;
553
690
  }
@@ -568,8 +705,23 @@ declare class MimeUtil {
568
705
  readonly CSV: "text/csv"; /** 制表符分隔值文件 */
569
706
  readonly TSV: "text/tab-separated-values"; /** XML 文档 */
570
707
  readonly XML: "text/xml"; /** XHTML 文档(XML 严格格式的 HTML) */
571
- readonly XHTML: "application/xhtml+xml"; /** JavaScript 脚本文件(标准推荐) */
572
- readonly JS: "text/javascript"; /** Markdown 格式文档 */
708
+ readonly XHTML: "application/xhtml+xml"; /** JavaScript 文件 */
709
+ readonly JS: "text/javascript"; /** TypeScript 文件 */
710
+ readonly TS: "text/typescript"; /** Python 文件 */
711
+ readonly PY: "text/x-python"; /** Shell 脚本 (.sh) */
712
+ readonly SH: "text/x-sh"; /** C 语言源文件 */
713
+ readonly C: "text/x-c"; /** C++ 源文件 */
714
+ readonly CPP: "text/x-c++"; /** C# 源文件 */
715
+ readonly CSHARP: "text/x-csharp"; /** Java 源文件 */
716
+ readonly JAVA: "text/x-java"; /** Go 源文件 */
717
+ readonly GO: "text/x-go"; /** Rust 源文件 */
718
+ readonly RUST: "text/x-rust"; /** PHP 文件 */
719
+ readonly PHP: "text/x-php"; /** Ruby 文件 */
720
+ readonly RUBY: "text/x-ruby"; /** Swift 源文件 */
721
+ readonly SWIFT: "text/x-swift"; /** YAML 文档 */
722
+ readonly YAML: "text/vnd.yaml"; /** TOML 文档 */
723
+ readonly TOML: "text/x-toml"; /** SQL 脚本 */
724
+ readonly SQL: "text/x-sql"; /** Markdown 格式文档 */
573
725
  readonly MARKDOWN: "text/markdown"; /** 富文本格式文档(.rtf) */
574
726
  readonly RTF: "application/rtf"; /** iCalendar 日历格式(.ics) */
575
727
  readonly CALENDAR: "text/calendar"; /** JPEG 图像(.jpg/.jpeg) */
@@ -581,7 +733,10 @@ declare class MimeUtil {
581
733
  readonly APNG: "image/apng"; /** AVIF 图像(高效压缩) */
582
734
  readonly AVIF: "image/avif"; /** 图标文件格式(.ico) */
583
735
  readonly ICO: "image/vnd.microsoft.icon"; /** WebP 图像(高效压缩) */
584
- readonly WEBP: "image/webp"; /** MP3 音频(.mp3) */
736
+ readonly WEBP: "image/webp"; /** TIFF 图像(.tif/.tiff) */
737
+ readonly TIFF: "image/tiff"; /** HEIC 图像(高效编码) */
738
+ readonly HEIC: "image/heic"; /** Adobe Photoshop 文件(.psd) */
739
+ readonly PSD: "image/vnd.adobe.photoshop"; /** MP3 音频(.mp3) */
585
740
  readonly MP3: "audio/mpeg"; /** AAC 音频(.aac) */
586
741
  readonly AAC: "audio/aac"; /** MIDI 音乐文件(.mid/.midi) */
587
742
  readonly MIDI: "audio/midi"; /** OGG 音频(.oga) */
@@ -615,13 +770,18 @@ declare class MimeUtil {
615
770
  readonly TAR: "application/x-tar"; /** BZip 归档(.bz) */
616
771
  readonly BZIP: "application/x-bzip"; /** BZip2 归档(.bz2) */
617
772
  readonly BZIP2: "application/x-bzip2"; /** 7-Zip 压缩文件(.7z) */
618
- readonly SEVEN_Z: "application/x-7z-compressed"; /** 通用二进制数据(默认类型) */
773
+ readonly SEVEN_Z: "application/x-7z-compressed"; /** RAR 压缩文件(.rar) */
774
+ readonly RAR: "application/vnd.rar"; /** 通用二进制数据(默认类型) */
619
775
  readonly OCTET_STREAM: "application/octet-stream"; /** JSON 数据格式(.json) */
620
776
  readonly JSON: "application/json"; /** JSON-LD 格式(.jsonld) */
621
777
  readonly LD_JSON: "application/ld+json"; /** Java 归档文件(.jar) */
622
- readonly JAR: "application/java-archive"; /** MS 嵌入式 OpenType 字体(.eot) */
778
+ readonly JAR: "application/java-archive"; /** WebAssembly 二进制指令格式(.wasm) */
779
+ readonly WASM: "application/wasm"; /** MS 嵌入式 OpenType 字体(.eot) */
623
780
  readonly EOT: "application/vnd.ms-fontobject"; /** OpenType 字体(.otf) */
624
- readonly OTF: "font/otf"; /** Excel 97-2003 工作簿(.xls) */
781
+ readonly OTF: "font/otf"; /** WOFF 字体(.woff) */
782
+ readonly WOFF: "font/woff"; /** WOFF2 字体(.woff2) */
783
+ readonly WOFF2: "font/woff2"; /** TrueType 字体(.ttf) */
784
+ readonly TTF: "font/ttf"; /** Excel 97-2003 工作簿(.xls) */
625
785
  readonly XLS: "application/vnd.ms-excel"; /** Microsoft XPS 文档(.xps) */
626
786
  readonly XPS: "application/vnd.ms-xpsdocument"; /** Word 启用宏文档(.docm) */
627
787
  readonly DOCM: "application/vnd.ms-word.document.macroEnabled.12";
@@ -650,7 +810,7 @@ declare class NumberUtil {
650
810
  static within(input: number, interval: [number, number], includeLeft?: boolean, includeRight?: boolean): boolean;
651
811
  }
652
812
  //#endregion
653
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/typed-array.d.ts
813
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/typed-array.d.ts
654
814
  /**
655
815
  Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
656
816
 
@@ -658,7 +818,24 @@ Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScrip
658
818
  */
659
819
  type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
660
820
  //#endregion
661
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/union-to-intersection.d.ts
821
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/characters.d.ts
822
+ /**
823
+ Matches any digit as a string ('0'-'9').
824
+
825
+ @example
826
+ ```
827
+ import type {DigitCharacter} from 'type-fest';
828
+
829
+ const a: DigitCharacter = '0'; // Valid
830
+ // @ts-expect-error
831
+ const b: DigitCharacter = 0; // Invalid
832
+ ```
833
+
834
+ @category Type
835
+ */
836
+ type DigitCharacter = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
837
+ //#endregion
838
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/union-to-intersection.d.ts
662
839
  /**
663
840
  Convert a union type to an intersection type.
664
841
 
@@ -687,7 +864,7 @@ Union extends unknown // The union type is used as the only argument to a functi
687
864
  ) extends ((mergedIntersection: infer Intersection) => void) // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
688
865
  ? Intersection & Union : never;
689
866
  //#endregion
690
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/keys-of-union.d.ts
867
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/keys-of-union.d.ts
691
868
  /**
692
869
  Create a union of all keys from a given type, even those exclusive to specific union members.
693
870
 
@@ -728,7 +905,7 @@ type AllKeys = KeysOfUnion<Union>;
728
905
  type KeysOfUnion<ObjectType> = // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
729
906
  keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
730
907
  //#endregion
731
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-any.d.ts
908
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/is-any.d.ts
732
909
  /**
733
910
  Returns a boolean for whether the given type is `any`.
734
911
 
@@ -759,7 +936,7 @@ const anyA = get(anyObject, 'a');
759
936
  */
760
937
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
761
938
  //#endregion
762
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-optional-key-of.d.ts
939
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/is-optional-key-of.d.ts
763
940
  /**
764
941
  Returns a boolean for whether the given key is an optional key of type.
765
942
 
@@ -802,7 +979,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
802
979
  */
803
980
  type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
804
981
  //#endregion
805
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/optional-keys-of.d.ts
982
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/optional-keys-of.d.ts
806
983
  /**
807
984
  Extract all optional keys from the given type.
808
985
 
@@ -840,7 +1017,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
840
1017
  ? (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`
841
1018
  : never;
842
1019
  //#endregion
843
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/required-keys-of.d.ts
1020
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/required-keys-of.d.ts
844
1021
  /**
845
1022
  Extract all required keys from the given type.
846
1023
 
@@ -874,7 +1051,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
874
1051
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
875
1052
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
876
1053
  //#endregion
877
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-never.d.ts
1054
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/is-never.d.ts
878
1055
  /**
879
1056
  Returns a boolean for whether the given type is `never`.
880
1057
 
@@ -930,7 +1107,7 @@ type B = IsTrueFixed<never>;
930
1107
  */
931
1108
  type IsNever<T> = [T] extends [never] ? true : false;
932
1109
  //#endregion
933
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/if.d.ts
1110
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/if.d.ts
934
1111
  /**
935
1112
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
936
1113
 
@@ -1025,7 +1202,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
1025
1202
  */
1026
1203
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
1027
1204
  //#endregion
1028
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/unknown-array.d.ts
1205
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/unknown-array.d.ts
1029
1206
  /**
1030
1207
  Represents an array with `unknown` value.
1031
1208
 
@@ -1052,7 +1229,7 @@ type C = IsArray<string>;
1052
1229
  */
1053
1230
  type UnknownArray = readonly unknown[];
1054
1231
  //#endregion
1055
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/type.d.ts
1232
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/internal/type.d.ts
1056
1233
  /**
1057
1234
  Returns a boolean for whether A is false.
1058
1235
 
@@ -1116,7 +1293,7 @@ Indicates the value of `exactOptionalPropertyTypes` compiler option.
1116
1293
  */
1117
1294
  type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?] ? false : true;
1118
1295
  //#endregion
1119
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/array.d.ts
1296
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/internal/array.d.ts
1120
1297
  /**
1121
1298
  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.
1122
1299
 
@@ -1158,7 +1335,7 @@ type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extend
1158
1335
  : First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
1159
1336
  : never; // Should never happen
1160
1337
  //#endregion
1161
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/numeric.d.ts
1338
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/numeric.d.ts
1162
1339
  type _Numeric = number | bigint;
1163
1340
  type Zero = 0 | 0n;
1164
1341
  /**
@@ -1203,7 +1380,7 @@ type IsNegative<T extends _Numeric> = T extends Negative<T> ? true : false;
1203
1380
  //#region ../../node_modules/.pnpm/tagged-tag@1.0.0/node_modules/tagged-tag/index.d.ts
1204
1381
  declare const tag: unique symbol;
1205
1382
  //#endregion
1206
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/tagged.d.ts
1383
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/tagged.d.ts
1207
1384
  // eslint-disable-next-line type-fest/require-exported-types
1208
1385
  type TagContainer<Token> = {
1209
1386
  readonly [tag]: Token;
@@ -1375,7 +1552,7 @@ type Person = {
1375
1552
  @deprecated Use {@link Tagged} instead
1376
1553
  */
1377
1554
  //#endregion
1378
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-literal.d.ts
1555
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/is-literal.d.ts
1379
1556
  /**
1380
1557
  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).
1381
1558
 
@@ -1437,7 +1614,7 @@ type _IsStringLiteral<S> = // If `T` is an infinite string type (e.g., `on${stri
1437
1614
  // and since `{}` extends index signatures, the result becomes `false`.
1438
1615
  S extends string ? {} extends Record<S, never> ? false : true : false;
1439
1616
  //#endregion
1440
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/tuple-of.d.ts
1617
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/tuple-of.d.ts
1441
1618
  /**
1442
1619
  Create a tuple type of the specified length with elements of the specified type.
1443
1620
 
@@ -1465,7 +1642,7 @@ type ZeroToFour = Range<0, 5>;
1465
1642
  //=> '0' | '1' | '2' | '3' | '4'
1466
1643
 
1467
1644
  type ThreeToEight = Range<3, 9>;
1468
- //=> '5' | '3' | '4' | '6' | '7' | '8'
1645
+ //=> '3' | '4' | '5' | '6' | '7' | '8'
1469
1646
  ```
1470
1647
 
1471
1648
  Note: If the specified length is the non-literal `number` type, the result will not be a tuple but a regular array.
@@ -1498,14 +1675,27 @@ type EmptyTuple = TupleOf<-3, string>;
1498
1675
  //=> []
1499
1676
  ```
1500
1677
 
1678
+ Note: If the specified length has a decimal part, the decimal part will be ignored.
1679
+
1680
+ @example
1681
+ ```
1682
+ import type {TupleOf} from 'type-fest';
1683
+
1684
+ type DecimalLength = TupleOf<3.5, string>;
1685
+ //=> [string, string, string]
1686
+ ```
1687
+
1501
1688
  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>>`.
1502
1689
 
1503
1690
  @category Array
1504
1691
  */
1505
- type TupleOf<Length extends number, Fill = unknown> = IfNotAnyOrNever<Length, _TupleOf<If<IsNegative<Length>, 0, Length>, Fill, []>, Fill[], []>;
1506
- type _TupleOf<L extends number, Fill, Accumulator extends UnknownArray> = number extends L ? Fill[] : L extends Accumulator['length'] ? Accumulator : _TupleOf<L, Fill, [...Accumulator, Fill]>;
1692
+ type TupleOf<Length extends number, Fill = unknown> = IfNotAnyOrNever<Length, _TupleOf<If<IsNegative<Length>, 0, Length>, Fill>, Fill[], []>;
1693
+ type _TupleOf<Length extends number, Fill> = number extends Length ? Fill[] : BuildTupleDigitByDigit<`${Length}`, Fill>;
1694
+ type BuildTupleDigitByDigit<Length extends string, Fill, Accumulator extends UnknownArray = []> = Length extends `${infer First extends DigitCharacter}${infer Rest}` ? BuildTupleDigitByDigit<Rest, Fill, [...RepeatTupleTenTimes<Accumulator>, ...DigitTupleOf<First, Fill>]> : Accumulator;
1695
+ type RepeatTupleTenTimes<Tuple extends UnknownArray> = [...Tuple, ...Tuple, ...Tuple, ...Tuple, ...Tuple, ...Tuple, ...Tuple, ...Tuple, ...Tuple, ...Tuple];
1696
+ type DigitTupleOf<Digit extends DigitCharacter, Fill> = [[], [Fill], [Fill, Fill], [Fill, Fill, Fill], [Fill, Fill, Fill, Fill], [Fill, Fill, Fill, Fill, Fill], [Fill, Fill, Fill, Fill, Fill, Fill], [Fill, Fill, Fill, Fill, Fill, Fill, Fill], [Fill, Fill, Fill, Fill, Fill, Fill, Fill, Fill], [Fill, Fill, Fill, Fill, Fill, Fill, Fill, Fill, Fill]][Digit];
1507
1697
  //#endregion
1508
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/simplify.d.ts
1698
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/simplify.d.ts
1509
1699
  /**
1510
1700
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
1511
1701
 
@@ -1566,7 +1756,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
1566
1756
  */
1567
1757
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
1568
1758
  //#endregion
1569
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-equal.d.ts
1759
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/is-equal.d.ts
1570
1760
  /**
1571
1761
  Returns a boolean for whether the two given types are equal.
1572
1762
 
@@ -1597,7 +1787,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
1597
1787
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
1598
1788
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
1599
1789
  //#endregion
1600
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/omit-index-signature.d.ts
1790
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/omit-index-signature.d.ts
1601
1791
  /**
1602
1792
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
1603
1793
 
@@ -1691,7 +1881,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
1691
1881
  */
1692
1882
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
1693
1883
  //#endregion
1694
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/pick-index-signature.d.ts
1884
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/pick-index-signature.d.ts
1695
1885
  /**
1696
1886
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
1697
1887
 
@@ -1739,7 +1929,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
1739
1929
  */
1740
1930
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
1741
1931
  //#endregion
1742
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/merge.d.ts
1932
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/merge.d.ts
1743
1933
  // Merges two objects without worrying about index signatures.
1744
1934
  type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
1745
1935
  /**
@@ -1811,7 +2001,7 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
1811
2001
  // Should never happen
1812
2002
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
1813
2003
  //#endregion
1814
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/object.d.ts
2004
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/internal/object.d.ts
1815
2005
  /**
1816
2006
  Works similar to the built-in `Pick` utility type, except for the following differences:
1817
2007
  - Distributes over union types and allows picking keys from any member of the union type.
@@ -1902,8 +2092,9 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
1902
2092
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
1903
2093
  ```
1904
2094
  */
1905
- 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>>>>;
1906
- // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
2095
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
2096
+ ? Result : never;
2097
+ type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key] }>>>;
1907
2098
  /**
1908
2099
  Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
1909
2100
 
@@ -1933,7 +2124,7 @@ type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined
1933
2124
  */
1934
2125
  type CollapseLiterals<T> = {} extends T ? T : T extends infer U & {} ? U : T;
1935
2126
  //#endregion
1936
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/some-extend.d.ts
2127
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/some-extend.d.ts
1937
2128
  /**
1938
2129
  @see {@link SomeExtend}
1939
2130
  */
@@ -2015,7 +2206,7 @@ type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOpt
2015
2206
  type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
2016
2207
  ? true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false, false, false>;
2017
2208
  //#endregion
2018
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/or-all.d.ts
2209
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/or-all.d.ts
2019
2210
  /**
2020
2211
  Returns a boolean for whether any of the given elements is `true`.
2021
2212
 
@@ -2086,7 +2277,7 @@ Note: `OrAll<[]>` evaluates to `false` because there are no `true` elements in a
2086
2277
  */
2087
2278
  type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;
2088
2279
  //#endregion
2089
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/or.d.ts
2280
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/or.d.ts
2090
2281
  /**
2091
2282
  Returns a boolean for whether either of two given types is `true`.
2092
2283
 
@@ -2166,7 +2357,7 @@ type G = Or<never, never>;
2166
2357
  */
2167
2358
  type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;
2168
2359
  //#endregion
2169
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/all-extend.d.ts
2360
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/all-extend.d.ts
2170
2361
  /**
2171
2362
  @see {@link AllExtend}
2172
2363
  */
@@ -2252,7 +2443,7 @@ type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptio
2252
2443
  type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
2253
2444
  ? _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true, false, false>;
2254
2445
  //#endregion
2255
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/and-all.d.ts
2446
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/and-all.d.ts
2256
2447
  /**
2257
2448
  Returns a boolean for whether all of the given elements are `true`.
2258
2449
 
@@ -2326,7 +2517,7 @@ Note: `AndAll<[]>` evaluates to `true` due to the concept of [vacuous truth](htt
2326
2517
  */
2327
2518
  type AndAll<T extends readonly boolean[]> = AllExtend<T, true>;
2328
2519
  //#endregion
2329
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/and.d.ts
2520
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/and.d.ts
2330
2521
  /**
2331
2522
  Returns a boolean for whether two given types are both `true`.
2332
2523
 
@@ -2406,7 +2597,7 @@ type G = And<never, never>;
2406
2597
  */
2407
2598
  type And<A extends boolean, B extends boolean> = AndAll<[A, B]>;
2408
2599
  //#endregion
2409
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/except.d.ts
2600
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/except.d.ts
2410
2601
  /**
2411
2602
  Filter out keys from an object.
2412
2603
 
@@ -2504,7 +2695,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
2504
2695
  type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
2505
2696
  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>> : {});
2506
2697
  //#endregion
2507
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/exclude-exactly.d.ts
2698
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/exclude-exactly.d.ts
2508
2699
  /**
2509
2700
  A stricter version of `Exclude<T, U>` that excludes types only when they are exactly identical.
2510
2701
 
@@ -2542,7 +2733,7 @@ type _ExcludeExactly<Union, Delete> = IfNotAnyOrNever<Delete, Union extends unkn
2542
2733
  // because `Union` cannot be `any` or `never` here.
2543
2734
  Union, Union>;
2544
2735
  //#endregion
2545
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/union-member.d.ts
2736
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/union-member.d.ts
2546
2737
  /**
2547
2738
  Returns an arbitrary member of a union type.
2548
2739
 
@@ -2599,7 +2790,7 @@ type LastNever = UnionMember<never>;
2599
2790
  */
2600
2791
  type UnionMember<T> = IsNever<T> extends true ? never : UnionToIntersection<T extends any ? () => T : never> extends (() => (infer R)) ? R : never;
2601
2792
  //#endregion
2602
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/union-to-tuple.d.ts
2793
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/union-to-tuple.d.ts
2603
2794
  /**
2604
2795
  Convert a union type into an unordered tuple type of its elements.
2605
2796
 
@@ -2639,7 +2830,7 @@ type UnionToTuple<Union> = _UnionToTuple<Union> extends infer Result extends Unk
2639
2830
  // Nudges the compiler that `UnionToTuple` always yields an array.
2640
2831
  type _UnionToTuple<Union, Accumulator extends UnknownArray = [], Member = UnionMember<Union>> = IsNever<Union> extends true ? Accumulator : _UnionToTuple<ExcludeExactly<Union, Member>, [Member, ...Accumulator]>;
2641
2832
  //#endregion
2642
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/set-optional.d.ts
2833
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/set-optional.d.ts
2643
2834
  /**
2644
2835
  Create a type that makes the given keys optional, while keeping the remaining keys as is.
2645
2836
 
@@ -2667,7 +2858,7 @@ type _SetOptional<BaseType, Keys extends keyof BaseType> = BaseType extends unkn
2667
2858
  Except<BaseType, Keys> // Pick the keys that should be mutable from the base type and make them mutable.
2668
2859
  & Partial<HomomorphicPick<BaseType, Keys>>> : never;
2669
2860
  //#endregion
2670
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/value-of.d.ts
2861
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/value-of.d.ts
2671
2862
  /**
2672
2863
  Create a union of the given object's values, and optionally specify which keys to get the values from.
2673
2864
 
@@ -2691,7 +2882,7 @@ type C = ValueOf<{id: number; name: string; active: boolean}, 'id' | 'name'>;
2691
2882
  */
2692
2883
  type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
2693
2884
  //#endregion
2694
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/split.d.ts
2885
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/split.d.ts
2695
2886
  /**
2696
2887
  Split options.
2697
2888
 
@@ -2748,7 +2939,7 @@ type SplitHelper<S extends string, Delimiter extends string, Options extends Req
2748
2939
  : string[] : never // Should never happen
2749
2940
  : never; // Should never happen
2750
2941
  //#endregion
2751
- //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/replace.d.ts
2942
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/replace.d.ts
2752
2943
  type ReplaceOptions = {
2753
2944
  all?: boolean;
2754
2945
  };
@@ -3304,7 +3495,18 @@ declare class ObjectUtil {
3304
3495
  * @returns 键数组
3305
3496
  * @example
3306
3497
  * ```ts
3498
+ * // 重载 1: string
3499
+ * ObjectUtil.keys("abc"); // ["0", "1", "2"]
3500
+ *
3501
+ * // 重载 2: ArrayLike
3502
+ * ObjectUtil.keys([10, 20]); // ["0", "1"]
3503
+ *
3504
+ * // 重载 3: PlainObject
3307
3505
  * ObjectUtil.keys({ a: 1, b: 2 }); // ["a", "b"]
3506
+ *
3507
+ * // 重载 4: AnyObject
3508
+ * const anyObj = { x: 1, y: 2 } as Record<string, unknown>;
3509
+ * ObjectUtil.keys(anyObj); // ["x", "y"]
3308
3510
  * ```
3309
3511
  */
3310
3512
  static keys<const S extends string>(string: S): UnionToTuple<Range<0, Split<S, "">["length"]>>;
@@ -3318,7 +3520,18 @@ declare class ObjectUtil {
3318
3520
  * @returns 值数组
3319
3521
  * @example
3320
3522
  * ```ts
3523
+ * // 重载 1: string
3524
+ * ObjectUtil.values("abc"); // ["a", "b", "c"]
3525
+ *
3526
+ * // 重载 2: ArrayLike
3527
+ * ObjectUtil.values([10, 20]); // [10, 20]
3528
+ *
3529
+ * // 重载 3: PlainObject
3321
3530
  * ObjectUtil.values({ a: 1, b: 2 }); // [1, 2]
3531
+ *
3532
+ * // 重载 4: AnyObject
3533
+ * const anyObj = { x: 1, y: 2 } as Record<string, unknown>;
3534
+ * ObjectUtil.values(anyObj); // [1, 2]
3322
3535
  * ```
3323
3536
  */
3324
3537
  static values<S extends string>(string: S): Split<S, "">;
@@ -3332,7 +3545,18 @@ declare class ObjectUtil {
3332
3545
  * @returns 键值对数组
3333
3546
  * @example
3334
3547
  * ```ts
3548
+ * // 重载 1: string
3549
+ * ObjectUtil.entries("ab"); // [["0", "a"], ["1", "b"]]
3550
+ *
3551
+ * // 重载 2: readonly array
3552
+ * ObjectUtil.entries([10, 20] as const); // [["0", 10], ["1", 20]]
3553
+ *
3554
+ * // 重载 3: PlainObject
3335
3555
  * ObjectUtil.entries({ a: 1 }); // [["a", 1]]
3556
+ *
3557
+ * // 重载 4: AnyObject
3558
+ * const anyObj = { x: 1 } as Record<string, unknown>;
3559
+ * ObjectUtil.entries(anyObj); // [["x", 1]]
3336
3560
  * ```
3337
3561
  */
3338
3562
  static entries<const S extends string>(string: S): TupleToEntries<Split<S, "">>;
@@ -3349,7 +3573,10 @@ declare class ObjectUtil {
3349
3573
  * @example
3350
3574
  * ```ts
3351
3575
  * const obj = { a: 1, b: 2 };
3576
+ *
3352
3577
  * ObjectUtil.entriesMap(obj, (k, v) => [k, v * 2]); // { a: 2, b: 4 }
3578
+ *
3579
+ * ObjectUtil.entriesMap(obj, (k, v) => [`prefix_${String(k)}`, `${v}x`]); // { prefix_a: "1x", prefix_b: "2x" }
3353
3580
  * ```
3354
3581
  */
3355
3582
  static entriesMap<O extends PlainObject, NK extends PropertyKey, NV>(plainObject: O, toEntry: (key: keyof O, value: O[keyof O]) => [NK, NV]): PlainObject<NK, NV>;
@@ -3361,7 +3588,12 @@ declare class ObjectUtil {
3361
3588
  * @returns 包含指定属性的新对象
3362
3589
  * @example
3363
3590
  * ```ts
3591
+ * // 重载 1: PlainObject
3364
3592
  * ObjectUtil.pick({ a: 1, b: 2 }, ["a"]); // { a: 1 }
3593
+ *
3594
+ * // 重载 2: AnyObject
3595
+ * const anyObj = { x: 1, y: 2 } as Record<string, unknown>;
3596
+ * ObjectUtil.pick(anyObj, ["x"]); // { x: 1 }
3365
3597
  * ```
3366
3598
  */
3367
3599
  static pick<O extends PlainObject, K extends keyof O>(plainObject: O, keys: readonly K[]): Pick<O, K>;
@@ -3374,7 +3606,12 @@ declare class ObjectUtil {
3374
3606
  * @returns 排除指定属性后的新对象
3375
3607
  * @example
3376
3608
  * ```ts
3609
+ * // 重载 1: PlainObject
3377
3610
  * ObjectUtil.omit({ a: 1, b: 2 }, ["a"]); // { b: 2 }
3611
+ *
3612
+ * // 重载 2: AnyObject
3613
+ * const anyObj = { x: 1, y: 2 } as Record<string, unknown>;
3614
+ * ObjectUtil.omit(anyObj, ["x"]); // { y: 2 }
3378
3615
  * ```
3379
3616
  */
3380
3617
  static omit<O extends PlainObject, K extends keyof O>(plainObject: O, keys: readonly K[]): Omit<O, K>;
@@ -3386,8 +3623,13 @@ declare class ObjectUtil {
3386
3623
  * @returns 键值互换后的对象
3387
3624
  * @example
3388
3625
  * ```ts
3626
+ * // 重载 1: Record<keyof O, PropertyKey>
3389
3627
  * const obj = { a: "1", b: 2 };
3390
3628
  * ObjectUtil.invert(obj); // { "1": "a", 2: "b" }
3629
+ *
3630
+ * // 重载 2: AnyObject
3631
+ * const anyObj = { x: Symbol.for("s"), y: true } as Record<string, unknown>;
3632
+ * ObjectUtil.invert(anyObj); // { [Symbol.for("s")]: "x" }
3391
3633
  * ```
3392
3634
  */
3393
3635
  static invert<const O extends Record<keyof O, PropertyKey>>(plainObject: O): Invert<O>;
@@ -3400,8 +3642,13 @@ declare class ObjectUtil {
3400
3642
  * @returns 压平后的对象
3401
3643
  * @example
3402
3644
  * ```ts
3403
- * const obj = { a: { b: 1 } };
3404
- * ObjectUtil.crush(obj); // { "a.b": 1 }
3645
+ * // 重载 1: PlainObject
3646
+ * const plainObj = { a: { b: 1 } };
3647
+ * ObjectUtil.crush(plainObj); // { "a.b": 1 }
3648
+ *
3649
+ * // 重载 2: AnyObject
3650
+ * const anyObj = { list: [{ id: 1 }] } as Record<string, unknown>;
3651
+ * ObjectUtil.crush(anyObj); // { "list.0.id": 1 }
3405
3652
  * ```
3406
3653
  */
3407
3654
  static crush<T extends PlainObject>(plainObject: T): Crush<T>;
@@ -3413,8 +3660,14 @@ declare class ObjectUtil {
3413
3660
  * @returns 键数组
3414
3661
  * @example
3415
3662
  * ```ts
3416
- * enum A { k = "v" }
3417
- * ObjectUtil.enumKeys(A); // ["k"]
3663
+ * // 重载 1: PlainObject
3664
+ * enum StringEnum { A = "a", B = "b" }
3665
+ * ObjectUtil.enumKeys(StringEnum); // ["A", "B"]
3666
+ *
3667
+ * // 重载 2: AnyObject
3668
+ * enum NumberEnum { A, B }
3669
+ * const anyEnum = NumberEnum as Record<string, unknown>;
3670
+ * ObjectUtil.enumKeys(anyEnum); // ["A", "B"]
3418
3671
  * ```
3419
3672
  */
3420
3673
  static enumKeys<E extends PlainObject>(enumeration: E): (keyof E)[];
@@ -3426,8 +3679,14 @@ declare class ObjectUtil {
3426
3679
  * @returns 值数组
3427
3680
  * @example
3428
3681
  * ```ts
3429
- * enum A { k = "v" }
3430
- * ObjectUtil.enumValues(A); // ["v"]
3682
+ * // 重载 1: PlainObject
3683
+ * enum StringEnum { A = "a", B = "b" }
3684
+ * ObjectUtil.enumValues(StringEnum); // ["a", "b"]
3685
+ *
3686
+ * // 重载 2: AnyObject
3687
+ * enum NumberEnum { A, B }
3688
+ * const anyEnum = NumberEnum as Record<string, unknown>;
3689
+ * ObjectUtil.enumValues(anyEnum); // [0, 1]
3431
3690
  * ```
3432
3691
  */
3433
3692
  static enumValues<E extends PlainObject>(enumeration: E): UnionToTuple<ValueOf<E>>;
@@ -3439,8 +3698,14 @@ declare class ObjectUtil {
3439
3698
  * @returns 键值对数组
3440
3699
  * @example
3441
3700
  * ```ts
3442
- * enum A { k = "v" }
3443
- * ObjectUtil.enumEntries(A); // [["k", "v"]]
3701
+ * // 重载 1: PlainObject
3702
+ * enum StringEnum { A = "a", B = "b" }
3703
+ * ObjectUtil.enumEntries(StringEnum); // [["A", "a"], ["B", "b"]]
3704
+ *
3705
+ * // 重载 2: AnyObject
3706
+ * enum NumberEnum { A, B }
3707
+ * const anyEnum = NumberEnum as Record<string, unknown>;
3708
+ * ObjectUtil.enumEntries(anyEnum); // [["A", 0], ["B", 1]]
3444
3709
  * ```
3445
3710
  */
3446
3711
  static enumEntries<E extends PlainObject>(enumeration: E): [keyof E, E[keyof E]][];
@@ -3474,7 +3739,10 @@ declare class StringUtil {
3474
3739
  * @returns 转换后的小写字符串类型,如果输入无效则返回空字符串类型 ""
3475
3740
  * @example
3476
3741
  * ```ts
3742
+ * // 重载 1: 输入 string
3477
3743
  * StringUtil.toLowerCase("HELLO"); // "hello"
3744
+ *
3745
+ * // 重载 2: 输入 unknown
3478
3746
  * StringUtil.toLowerCase(null); // ""
3479
3747
  * ```
3480
3748
  */
@@ -3489,7 +3757,10 @@ declare class StringUtil {
3489
3757
  * @returns 转换后的大写字符串,如果输入无效则返回空字符串
3490
3758
  * @example
3491
3759
  * ```ts
3760
+ * // 重载 1: 输入 string
3492
3761
  * StringUtil.toUpperCase("hello"); // "HELLO"
3762
+ *
3763
+ * // 重载 2: 输入 unknown
3493
3764
  * StringUtil.toUpperCase(null); // ""
3494
3765
  * ```
3495
3766
  */
@@ -3543,8 +3814,12 @@ declare class StringUtil {
3543
3814
  * @returns 解析后的对象 或 回退值
3544
3815
  * @example
3545
3816
  * ```ts
3546
- * StringUtil.toJson('{"a": 1}', {}); // { a: 1 }
3547
- * StringUtil.toJson('invalid', {}); // {}
3817
+ * // 重载 1: fallback
3818
+ * StringUtil.toJson<{ a: number }>("{\"a\":1}"); // { a: 1 }
3819
+ * StringUtil.toJson("invalid"); // undefined
3820
+ *
3821
+ * // 重载 2: 有 fallback
3822
+ * StringUtil.toJson<{ a: number }>("invalid", { a: 0 }); // { a: 0 }
3548
3823
  * ```
3549
3824
  */
3550
3825
  static toJson<D extends AnyObject = AnyObject>(input: string | null | undefined): D | undefined;
@@ -3559,7 +3834,10 @@ declare class StringUtil {
3559
3834
  * @returns 分割后的数组
3560
3835
  * @example
3561
3836
  * ```ts
3837
+ * // 重载 1: valueType = "number" (默认)
3562
3838
  * StringUtil.toValues("1,2,3"); // [1, 2, 3]
3839
+ *
3840
+ * // 重载 2: valueType = "string"
3563
3841
  * StringUtil.toValues("a-b-c", "string", "-"); // ["a", "b", "c"]
3564
3842
  * ```
3565
3843
  */
@@ -3627,10 +3905,28 @@ declare class StringUtil {
3627
3905
  * 主题工具类
3628
3906
  */
3629
3907
  declare class ThemeUtil {
3908
+ /**
3909
+ * 固定主题类型(仅亮色/暗色)
3910
+ *
3911
+ * @example
3912
+ * ```ts
3913
+ * ThemeUtil.THEME.LIGHT; // "light"
3914
+ * ThemeUtil.THEME.DARK; // "dark"
3915
+ * ```
3916
+ */
3630
3917
  static readonly THEME: {
3631
3918
  readonly LIGHT: "light";
3632
3919
  readonly DARK: "dark";
3633
3920
  };
3921
+ /**
3922
+ * 主题模式(支持跟随系统)
3923
+ *
3924
+ * @example
3925
+ * ```ts
3926
+ * ThemeUtil.THEME_MODE.SYSTEM; // "system"
3927
+ * ThemeUtil.THEME_MODE.DARK; // "dark"
3928
+ * ```
3929
+ */
3634
3930
  static readonly THEME_MODE: {
3635
3931
  readonly LIGHT: "light";
3636
3932
  readonly DARK: "dark";
@@ -3748,8 +4044,12 @@ declare class TreeUtil {
3748
4044
  * @example
3749
4045
  * ```ts
3750
4046
  * const tree = [{ id: 1, visible: true, children: [{ id: 2, visible: false }] }];
3751
- * TreeUtil.filter(tree, (node) => node.visible);
3752
- * // [{ id: 1, visible: true, children: [] }]
4047
+ *
4048
+ * // 重载 1: 传入树数组
4049
+ * TreeUtil.filter(tree, (node) => node.visible); // [{ id: 1, visible: true, children: [] }]
4050
+ *
4051
+ * // 重载 2: 传入单个树节点
4052
+ * TreeUtil.filter(tree[0], (node) => node.visible); // { id: 1, visible: true, children: [] }
3753
4053
  * ```
3754
4054
  */
3755
4055
  static filter<T extends AnyObject, CK extends string = ChildrenKey>(tree: T[], callback: TreeFilterCallback<T>, options?: TreeFilterOptions<T, CK>): T[];
@@ -3765,8 +4065,14 @@ declare class TreeUtil {
3765
4065
  * @example
3766
4066
  * ```ts
3767
4067
  * const tree = [{ id: 1, val: 10, children: [{ id: 2, val: 20 }] }];
4068
+ *
4069
+ * // 重载 1: 传入树数组
3768
4070
  * TreeUtil.map(tree, (node) => ({ ...node, val: node.val * 2 }));
3769
4071
  * // [{ id: 1, val: 20, children: [{ id: 2, val: 40 }] }]
4072
+ *
4073
+ * // 重载 2: 传入单个树节点
4074
+ * TreeUtil.map(tree[0], (node) => ({ ...node, val: node.val * 2 }));
4075
+ * // { id: 1, val: 20, children: [{ id: 2, val: 40 }] }
3770
4076
  * ```
3771
4077
  */
3772
4078
  static map<R extends AnyObject, T extends AnyObject, CK extends string = ChildrenKey>(tree: T[], callback: TreeMapCallback<R, T>, options?: TreeMapOptions<T, CK>): TreeLike<R, CK>[];
@@ -3810,9 +4116,10 @@ declare class TypeUtil {
3810
4116
  static isString(value: unknown, checkEmpty?: boolean): value is string;
3811
4117
  /**
3812
4118
  * 检查 value 是否为 number 类型
4119
+ * - 默认会调用 `TypeUtil.isNaN`(内部基于 `Number.isNaN`)过滤掉 `NaN`
3813
4120
  *
3814
4121
  * @param value 待检查值
3815
- * @param checkNaN 是否排除 `NaN`,默认为 `true`
4122
+ * @param checkNaN 是否检查 `NaN`,默认为 `true`
3816
4123
  * @returns 是否为 number
3817
4124
  * @example
3818
4125
  * ```ts
@@ -3824,9 +4131,15 @@ declare class TypeUtil {
3824
4131
  static isNumber(value: unknown, checkNaN?: boolean): value is number;
3825
4132
  /**
3826
4133
  * 检查 value 是否为 NaN
4134
+ * - 禁止使用全局 `isNaN`,其会先进行隐式数字转换,可能导致误判(例如 `isNaN("foo") === true`)
4135
+ * - 使用 `Number.isNaN` 仅在值本身就是 `NaN` 时返回 `true`,语义更严格且更安全
3827
4136
  *
3828
4137
  * @param value 待检查值
3829
4138
  * @returns 是否为 NaN
4139
+ * @example
4140
+ * ```ts
4141
+ * TypeUtil.isNaN(NaN); // true
4142
+ * ```
3830
4143
  */
3831
4144
  static isNaN(value: unknown): value is number;
3832
4145
  /**
@@ -3835,6 +4148,11 @@ declare class TypeUtil {
3835
4148
  * @param value 待检查值
3836
4149
  * @param checkSafe 是否附加安全整数检查
3837
4150
  * @returns 是否为整数
4151
+ * @example
4152
+ * ```ts
4153
+ * TypeUtil.isInteger(1); // true
4154
+ * TypeUtil.isInteger(1.1); // false
4155
+ * ```
3838
4156
  */
3839
4157
  static isInteger(value: unknown, checkSafe?: boolean): value is number;
3840
4158
  /**
@@ -3843,6 +4161,11 @@ declare class TypeUtil {
3843
4161
  *
3844
4162
  * @param value 待检查值
3845
4163
  * @param checkSafe 是否附加安全整数检查
4164
+ * @example
4165
+ * ```ts
4166
+ * TypeUtil.isPositiveInteger(1); // true
4167
+ * TypeUtil.isPositiveInteger(0); // false
4168
+ * ```
3846
4169
  */
3847
4170
  static isPositiveInteger(value: unknown, checkSafe?: boolean): value is number;
3848
4171
  /**
@@ -3851,6 +4174,11 @@ declare class TypeUtil {
3851
4174
  *
3852
4175
  * @param value 待检查值
3853
4176
  * @param checkSafe 是否附加安全整数检查
4177
+ * @example
4178
+ * ```ts
4179
+ * TypeUtil.isNegativeInteger(-1); // true
4180
+ * TypeUtil.isNegativeInteger(0); // false
4181
+ * ```
3854
4182
  */
3855
4183
  static isNegativeInteger(value: unknown, checkSafe?: boolean): value is number;
3856
4184
  /**
@@ -3858,6 +4186,11 @@ declare class TypeUtil {
3858
4186
  * - 排除 `NaN`
3859
4187
  *
3860
4188
  * @param value 待检查值
4189
+ * @example
4190
+ * ```ts
4191
+ * TypeUtil.isInfinity(Infinity); // true
4192
+ * TypeUtil.isInfinity(1); // false
4193
+ * ```
3861
4194
  */
3862
4195
  static isInfinity(value: unknown): value is number;
3863
4196
  /**
@@ -3865,66 +4198,111 @@ declare class TypeUtil {
3865
4198
  * - 排除 `NaN`
3866
4199
  *
3867
4200
  * @param value 待检查值
4201
+ * @example
4202
+ * ```ts
4203
+ * TypeUtil.isInfinityLike("Infinity"); // true
4204
+ * TypeUtil.isInfinityLike("123"); // false
4205
+ * ```
3868
4206
  */
3869
4207
  static isInfinityLike(value: unknown): boolean;
3870
4208
  /**
3871
4209
  * 检查 value 是否为 Boolean
3872
4210
  * @param value 待检查值
3873
4211
  * @returns 是否为 Boolean
4212
+ * @example
4213
+ * ```ts
4214
+ * TypeUtil.isBoolean(false); // true
4215
+ * ```
3874
4216
  */
3875
4217
  static isBoolean(value: unknown): value is boolean;
3876
4218
  /**
3877
4219
  * 检查 value 是否为 BigInt
3878
4220
  * @param value 待检查值
3879
4221
  * @returns 是否为 BigInt
4222
+ * @example
4223
+ * ```ts
4224
+ * TypeUtil.isBigInt(1n); // true
4225
+ * ```
3880
4226
  */
3881
4227
  static isBigInt(value: unknown): value is bigint;
3882
4228
  /**
3883
4229
  * 检查 value 是否为 Symbol
3884
4230
  * @param value 待检查值
3885
4231
  * @returns 是否为 Symbol
4232
+ * @example
4233
+ * ```ts
4234
+ * TypeUtil.isSymbol(Symbol("a")); // true
4235
+ * ```
3886
4236
  */
3887
4237
  static isSymbol(value: unknown): value is symbol;
3888
4238
  /**
3889
4239
  * 检查 value 是否为 undefined
3890
4240
  * @param value 待检查值
3891
4241
  * @returns 是否为 undefined
4242
+ * @example
4243
+ * ```ts
4244
+ * TypeUtil.isUndefined(undefined); // true
4245
+ * ```
3892
4246
  */
3893
4247
  static isUndefined(value: unknown): value is undefined;
3894
4248
  /**
3895
4249
  * 检查 value 是否为 null
3896
4250
  * @param value 待检查值
3897
4251
  * @returns 是否为 null
4252
+ * @example
4253
+ * ```ts
4254
+ * TypeUtil.isNull(null); // true
4255
+ * ```
3898
4256
  */
3899
4257
  static isNull(value: unknown): value is null;
3900
4258
  /**
3901
4259
  * 检查 value 是否为 Function
3902
4260
  * @param value 待检查值
3903
4261
  * @returns 是否为 Function
4262
+ * @example
4263
+ * ```ts
4264
+ * TypeUtil.isFunction(() => {}); // true
4265
+ * ```
3904
4266
  */
3905
4267
  static isFunction(value: unknown): value is AnyFunction;
3906
4268
  /**
3907
4269
  * 检查 value 是否为 AsyncFunction
3908
4270
  * @param value 待检查值
3909
4271
  * @returns 是否为 AsyncFunction
4272
+ * @example
4273
+ * ```ts
4274
+ * TypeUtil.isAsyncFunction(async () => {}); // true
4275
+ * ```
3910
4276
  */
3911
4277
  static isAsyncFunction(value: unknown): value is AnyAsyncFunction;
3912
4278
  /**
3913
4279
  * 检查 value 是否为 GeneratorFunction
3914
4280
  * @param value 待检查值
3915
4281
  * @returns 是否为 GeneratorFunction
4282
+ * @example
4283
+ * ```ts
4284
+ * TypeUtil.isGeneratorFunction(function * a () {}); // true
4285
+ * ```
3916
4286
  */
3917
4287
  static isGeneratorFunction(value: unknown): value is AnyGeneratorFunction;
3918
4288
  /**
3919
4289
  * 检查 value 是否为 AsyncGeneratorFunction
3920
4290
  * @param value 待检查值
3921
4291
  * @returns 是否为 AsyncGeneratorFunction
4292
+ * @example
4293
+ * ```ts
4294
+ * TypeUtil.isAsyncGeneratorFunction(async function * a () {}); // true
4295
+ * ```
3922
4296
  */
3923
4297
  static isAsyncGeneratorFunction(value: unknown): value is AnyAsyncGeneratorFunction;
3924
4298
  /**
3925
4299
  * 检查 value 是否为 Promise
3926
4300
  * @param value 待检查值
3927
4301
  * @returns 是否为 Promise
4302
+ * @example
4303
+ * ```ts
4304
+ * TypeUtil.isPromise(Promise.resolve(1)); // true
4305
+ * ```
3928
4306
  */
3929
4307
  static isPromise(value: unknown): value is Promise<unknown>;
3930
4308
  /**
@@ -3932,6 +4310,10 @@ declare class TypeUtil {
3932
4310
  * - 可识别拥有 then 方法的非 Promise 对象
3933
4311
  * @param value 待检查值
3934
4312
  * @returns 是否为 PromiseLike
4313
+ * @example
4314
+ * ```ts
4315
+ * TypeUtil.isPromiseLike({ then: () => {} }); // true
4316
+ * ```
3935
4317
  */
3936
4318
  static isPromiseLike(value: unknown): value is PromiseLike<unknown>;
3937
4319
  /**
@@ -3962,6 +4344,11 @@ declare class TypeUtil {
3962
4344
  *
3963
4345
  * @param enumeration 待检查值
3964
4346
  * @returns [是否为有效的枚举, 是否为双向枚举]
4347
+ * @example
4348
+ * ```ts
4349
+ * enum A { X, Y }
4350
+ * TypeUtil.isEnumeration(A); // [true, true]
4351
+ * ```
3965
4352
  */
3966
4353
  static isEnumeration(enumeration: PlainObject): [boolean, boolean];
3967
4354
  /**
@@ -4003,36 +4390,60 @@ declare class TypeUtil {
4003
4390
  * 检查 value 是否为 Map
4004
4391
  * @param value 待检查值
4005
4392
  * @returns 是否为 Map
4393
+ * @example
4394
+ * ```ts
4395
+ * TypeUtil.isMap(new Map()); // true
4396
+ * ```
4006
4397
  */
4007
4398
  static isMap(value: unknown): value is Map<unknown, unknown>;
4008
4399
  /**
4009
4400
  * 检查 value 是否为 WeakMap
4010
4401
  * @param value 待检查值
4011
4402
  * @returns 是否为 WeakMap
4403
+ * @example
4404
+ * ```ts
4405
+ * TypeUtil.isWeakMap(new WeakMap()); // true
4406
+ * ```
4012
4407
  */
4013
4408
  static isWeakMap(value: unknown): value is WeakMap<AnyObject, unknown>;
4014
4409
  /**
4015
4410
  * 检查 value 是否为 Set
4016
4411
  * @param value 待检查值
4017
4412
  * @returns 是否为 Set
4413
+ * @example
4414
+ * ```ts
4415
+ * TypeUtil.isSet(new Set()); // true
4416
+ * ```
4018
4417
  */
4019
4418
  static isSet(value: unknown): value is Set<unknown>;
4020
4419
  /**
4021
4420
  * 检查 value 是否为 WeakSet
4022
4421
  * @param value 待检查值
4023
4422
  * @returns 是否为 WeakSet
4423
+ * @example
4424
+ * ```ts
4425
+ * TypeUtil.isWeakSet(new WeakSet()); // true
4426
+ * ```
4024
4427
  */
4025
4428
  static isWeakSet(value: unknown): value is WeakSet<AnyObject>;
4026
4429
  /**
4027
4430
  * 检查 value 是否为 Blob
4028
4431
  * @param value 待检查值
4029
4432
  * @returns 是否为 Blob
4433
+ * @example
4434
+ * ```ts
4435
+ * TypeUtil.isBlob(new Blob(["a"])); // true
4436
+ * ```
4030
4437
  */
4031
4438
  static isBlob(value: unknown): value is Blob;
4032
4439
  /**
4033
4440
  * 检查 value 是否为 File
4034
4441
  * @param value 待检查值
4035
4442
  * @returns 是否为 File
4443
+ * @example
4444
+ * ```ts
4445
+ * TypeUtil.isFile(new File(["a"], "a.txt")); // true
4446
+ * ```
4036
4447
  */
4037
4448
  static isFile(value: unknown): value is File;
4038
4449
  /**
@@ -4044,18 +4455,30 @@ declare class TypeUtil {
4044
4455
  *
4045
4456
  * @param value 待检查值
4046
4457
  * @returns 是否为 ReadableStream
4458
+ * @example
4459
+ * ```ts
4460
+ * TypeUtil.isReadableStream(new ReadableStream()); // true
4461
+ * ```
4047
4462
  */
4048
4463
  static isReadableStream(value: unknown): value is ReadableStream;
4049
4464
  /**
4050
4465
  * 检查 value 是否为 Window
4051
4466
  * @param value 待检查值
4052
4467
  * @returns 是否为 Window
4468
+ * @example
4469
+ * ```ts
4470
+ * TypeUtil.isWindow(window); // true
4471
+ * ```
4053
4472
  */
4054
4473
  static isWindow(value: unknown): value is Window;
4055
4474
  /**
4056
4475
  * 检查 value 是否为 HTMLIFrameElement
4057
4476
  * @param value 待检查值
4058
4477
  * @returns 是否为 HTMLIFrameElement
4478
+ * @example
4479
+ * ```ts
4480
+ * TypeUtil.isIframe(document.createElement("iframe")); // true
4481
+ * ```
4059
4482
  */
4060
4483
  static isIframe(value: unknown): value is HTMLIFrameElement;
4061
4484
  /**
@@ -4081,36 +4504,60 @@ declare class TypeUtil {
4081
4504
  * 检查 value 是否为 Error 对象
4082
4505
  * @param value 待检查值
4083
4506
  * @returns 是否为 Error
4507
+ * @example
4508
+ * ```ts
4509
+ * TypeUtil.isError(new Error("x")); // true
4510
+ * ```
4084
4511
  */
4085
4512
  static isError(value: unknown): value is Error;
4086
4513
  /**
4087
4514
  * 检查 value 是否为 RegExp
4088
4515
  * @param value 待检查值
4089
4516
  * @returns 是否为 RegExp
4517
+ * @example
4518
+ * ```ts
4519
+ * TypeUtil.isRegExp(/a/); // true
4520
+ * ```
4090
4521
  */
4091
4522
  static isRegExp(value: unknown): value is RegExp;
4092
4523
  /**
4093
4524
  * 检查 value 是否为 WebSocket
4094
4525
  * @param value 待检查值
4095
4526
  * @returns 是否为 WebSocket
4527
+ * @example
4528
+ * ```ts
4529
+ * TypeUtil.isWebSocket(new WebSocket("wss://echo.websocket.events")); // true
4530
+ * ```
4096
4531
  */
4097
4532
  static isWebSocket(value: unknown): value is WebSocket;
4098
4533
  /**
4099
4534
  * 检查 value 是否为 URLSearchParams
4100
4535
  * @param value 待检查值
4101
4536
  * @returns 是否为 URLSearchParams
4537
+ * @example
4538
+ * ```ts
4539
+ * TypeUtil.isURLSearchParams(new URLSearchParams("a=1")); // true
4540
+ * ```
4102
4541
  */
4103
4542
  static isURLSearchParams(value: unknown): value is URLSearchParams;
4104
4543
  /**
4105
4544
  * 检查 value 是否为 AbortSignal
4106
4545
  * @param value 待检查值
4107
4546
  * @returns 是否为 AbortSignal
4547
+ * @example
4548
+ * ```ts
4549
+ * TypeUtil.isAbortSignal(new AbortController().signal); // true
4550
+ * ```
4108
4551
  */
4109
4552
  static isAbortSignal(value: unknown): value is AbortSignal;
4110
4553
  /**
4111
4554
  * 检查 value 是否为可迭代对象 (Iterable)
4112
4555
  * @param value 待检查值
4113
4556
  * @returns 是否为 Iterable
4557
+ * @example
4558
+ * ```ts
4559
+ * TypeUtil.isIterable([1, 2]); // true
4560
+ * ```
4114
4561
  */
4115
4562
  static isIterable(value: unknown): value is {
4116
4563
  [Symbol.iterator]: () => Iterator<unknown>;
@@ -4119,8 +4566,24 @@ declare class TypeUtil {
4119
4566
  * 检查 value 是否为 Falsy 值 (false, 0, "", null, undefined, NaN)
4120
4567
  * @param value 待检查值
4121
4568
  * @returns 是否为 Falsy
4569
+ * @example
4570
+ * ```ts
4571
+ * TypeUtil.isFalsy(0); // true
4572
+ * ```
4122
4573
  */
4123
4574
  static isFalsy(value: unknown): value is false | 0 | "" | null | undefined;
4575
+ /**
4576
+ * 检查 value 是否为 FalsyLike 值
4577
+ * - 包含字符串形式的 `"null"`、`"undefined"`、`"false"`、`"0"` 等
4578
+ *
4579
+ * @param value 待检查值
4580
+ * @returns 是否为 FalsyLike
4581
+ * @example
4582
+ * ```ts
4583
+ * TypeUtil.isFalsyLike("false"); // true
4584
+ * TypeUtil.isFalsyLike("hello"); // false
4585
+ * ```
4586
+ */
4124
4587
  static isFalsyLike(value: unknown): boolean;
4125
4588
  }
4126
4589
  //#endregion
@@ -4132,162 +4595,290 @@ declare class ValidateUtil {
4132
4595
  static _phone: RegExp;
4133
4596
  /**
4134
4597
  * 验证是否为手机号码
4598
+ * @example
4599
+ * ```ts
4600
+ * ValidateUtil.isPhone("13800138000"); // true
4601
+ * ```
4135
4602
  */
4136
4603
  static isPhone(input: string): boolean;
4137
4604
  static _telephone: RegExp;
4138
4605
  /**
4139
4606
  * 验证是否为固定电话
4607
+ * @example
4608
+ * ```ts
4609
+ * ValidateUtil.isTelephone("010-12345678"); // true
4610
+ * ```
4140
4611
  */
4141
4612
  static isTelephone(input: string): boolean;
4142
4613
  static _IMEI: RegExp;
4143
4614
  /**
4144
4615
  * 验证是否为移动设备识别码
4616
+ * @example
4617
+ * ```ts
4618
+ * ValidateUtil.isIMEI("490154203237518"); // true
4619
+ * ```
4145
4620
  */
4146
4621
  static isIMEI(input: string): boolean;
4147
4622
  static _email: RegExp;
4148
4623
  /**
4149
4624
  * 验证是否为电子邮箱
4625
+ * @example
4626
+ * ```ts
4627
+ * ValidateUtil.isEmail("dev@example.com"); // true
4628
+ * ```
4150
4629
  */
4151
4630
  static isEmail(input: string): boolean;
4152
4631
  static _link: RegExp;
4153
4632
  /**
4154
4633
  * 验证是否为 http(s) 链接
4634
+ * @example
4635
+ * ```ts
4636
+ * ValidateUtil.isHttpLink("https://example.com/path"); // true
4637
+ * ```
4155
4638
  */
4156
4639
  static isHttpLink(input: string): boolean;
4157
4640
  static _portLink: RegExp;
4158
4641
  /**
4159
4642
  * 验证是否为端口号链接
4643
+ * @example
4644
+ * ```ts
4645
+ * ValidateUtil.isPortLink("http://example.com:8080"); // true
4646
+ * ```
4160
4647
  */
4161
4648
  static isPortLink(input: string): boolean;
4162
4649
  static _thunderLink: RegExp;
4163
4650
  /**
4164
4651
  * 验证是否为迅雷链接
4652
+ * @example
4653
+ * ```ts
4654
+ * ValidateUtil.isThunderLink("thunder://QUFodHRwOi8vZXhhbXBsZS5jb20vZmlsZQ=="); // true
4655
+ * ```
4165
4656
  */
4166
4657
  static isThunderLink(input: string): boolean;
4167
4658
  static _uscc: RegExp;
4168
4659
  /**
4169
4660
  * 验证是否为统一社会信用代码
4661
+ * @example
4662
+ * ```ts
4663
+ * ValidateUtil.isUSCC("91350100M000100Y43"); // true
4664
+ * ```
4170
4665
  */
4171
4666
  static isUSCC(input: string): boolean;
4172
4667
  static _usccs: RegExp;
4173
4668
  /**
4174
4669
  * 验证是否为统一社会信用代码 - 15位/18位/20位数字/字母
4670
+ * @example
4671
+ * ```ts
4672
+ * ValidateUtil.isUSCCS("91350100M000100Y43"); // true
4673
+ * ```
4175
4674
  */
4176
4675
  static isUSCCS(input: string): boolean;
4177
4676
  static _dirPathWindows: RegExp;
4178
4677
  /**
4179
4678
  * 验证是否为 Windows 系统文件夹路径
4679
+ * @example
4680
+ * ```ts
4681
+ * ValidateUtil.isDirPathWindows("C:\\Users\\pawover\\"); // true
4682
+ * ```
4180
4683
  */
4181
4684
  static isDirPathWindows(input: string): boolean;
4182
4685
  static _filePathWindows: RegExp;
4183
4686
  /**
4184
4687
  * 验证是否为 Windows 系统文件路径
4688
+ * @example
4689
+ * ```ts
4690
+ * ValidateUtil.isFilePathWindows("C:\\Users\\pawover\\a.txt"); // true
4691
+ * ```
4185
4692
  */
4186
4693
  static isFilePathWindows(input: string): boolean;
4187
4694
  static _dirPathLinux: RegExp;
4188
4695
  /**
4189
4696
  * 验证是否为 Linux 系统文件夹路径
4697
+ * @example
4698
+ * ```ts
4699
+ * ValidateUtil.isDirPathLinux("/usr/local/"); // true
4700
+ * ```
4190
4701
  */
4191
4702
  static isDirPathLinux(input: string): boolean;
4192
4703
  static _filePathLinux: RegExp;
4193
4704
  /**
4194
4705
  * 验证是否为 Linux 系统文件路径
4706
+ * @example
4707
+ * ```ts
4708
+ * ValidateUtil.isFilePathLinux("/usr/local/bin/node"); // true
4709
+ * ```
4195
4710
  */
4196
4711
  static isFilePathLinux(input: string): boolean;
4197
4712
  static _EVCarNumber: RegExp;
4198
4713
  /**
4199
4714
  * 验证是否为新能源车牌号
4715
+ * @example
4716
+ * ```ts
4717
+ * ValidateUtil.isEVCarNumber("粤AD12345"); // true
4718
+ * ```
4200
4719
  */
4201
4720
  static isEVCarNumber(input: string): boolean;
4202
4721
  static _GVCarNumber: RegExp;
4203
4722
  /**
4204
4723
  * 验证是否为燃油车车牌号
4724
+ * @example
4725
+ * ```ts
4726
+ * ValidateUtil.isGVCarNumber("粤B12345"); // true
4727
+ * ```
4205
4728
  */
4206
4729
  static isGVCarNumber(input: string): boolean;
4207
4730
  static _chineseName: RegExp;
4208
4731
  /**
4209
4732
  * 验证是否为中文姓名
4733
+ * @example
4734
+ * ```ts
4735
+ * ValidateUtil.isChineseName("张三"); // true
4736
+ * ```
4210
4737
  */
4211
4738
  static isChineseName(input: string): boolean;
4212
4739
  static _chineseId: RegExp;
4213
4740
  /**
4214
4741
  * 验证是否为中国身份证号
4742
+ * @example
4743
+ * ```ts
4744
+ * ValidateUtil.isChineseID("11010519491231002X"); // true
4745
+ * ```
4215
4746
  */
4216
4747
  static isChineseID(input: string): boolean;
4217
4748
  static _chineseProvince: RegExp;
4218
4749
  /**
4219
4750
  * 验证是否为中国省份
4751
+ * @example
4752
+ * ```ts
4753
+ * ValidateUtil.isChineseProvince("浙江"); // true
4754
+ * ```
4220
4755
  */
4221
4756
  static isChineseProvince(input: string): boolean;
4222
4757
  static _chineseNation: RegExp;
4223
4758
  /**
4224
4759
  * 验证是否为中华民族
4760
+ * @example
4761
+ * ```ts
4762
+ * ValidateUtil.isChineseNation("汉族"); // true
4763
+ * ```
4225
4764
  */
4226
4765
  static isChineseNation(input: string): boolean;
4227
4766
  static _letter: RegExp;
4228
4767
  /**
4229
4768
  * 验证是否只包含字母
4769
+ * @example
4770
+ * ```ts
4771
+ * ValidateUtil.isLetter("abcDEF"); // true
4772
+ * ```
4230
4773
  */
4231
4774
  static isLetter(input: string): boolean;
4232
4775
  static _letterLowercase: RegExp;
4233
4776
  /**
4234
4777
  * 验证是否只包含小写字母
4778
+ * @example
4779
+ * ```ts
4780
+ * ValidateUtil.isLetterLowercase("abc"); // true
4781
+ * ```
4235
4782
  */
4236
4783
  static isLetterLowercase(input: string): boolean;
4237
4784
  static _letterUppercase: RegExp;
4238
4785
  /**
4239
4786
  * 验证是否只包含大写字母
4787
+ * @example
4788
+ * ```ts
4789
+ * ValidateUtil.isLetterUppercase("ABC"); // true
4790
+ * ```
4240
4791
  */
4241
4792
  static isLetterUppercase(input: string): boolean;
4242
4793
  static _letterOmit: RegExp;
4243
4794
  /**
4244
4795
  * 验证是否不包含字母
4796
+ * @example
4797
+ * ```ts
4798
+ * ValidateUtil.isLetterOmit("123_-"); // true
4799
+ * ```
4245
4800
  */
4246
4801
  static isLetterOmit(input: string): boolean;
4247
4802
  static _LetterAndNumber: RegExp;
4248
4803
  /**
4249
4804
  * 验证是否为数字和字母组合
4805
+ * @example
4806
+ * ```ts
4807
+ * ValidateUtil.isLetterAndNumber("A1B2"); // true
4808
+ * ```
4250
4809
  */
4251
4810
  static isLetterAndNumber(input: string): boolean;
4252
4811
  static _signedFloat: RegExp;
4253
4812
  /**
4254
4813
  * 验证是否为有符号浮点数
4814
+ * @example
4815
+ * ```ts
4816
+ * ValidateUtil.isSignedFloat("-12.34"); // true
4817
+ * ```
4255
4818
  */
4256
4819
  static isSignedFloat(input: string): boolean;
4257
4820
  static _unsignedFloat: RegExp;
4258
4821
  /**
4259
4822
  * 验证是否为无符号浮点数
4823
+ * @example
4824
+ * ```ts
4825
+ * ValidateUtil.isUnsignedFloat("12.34"); // true
4826
+ * ```
4260
4827
  */
4261
4828
  static isUnsignedFloat(input: string): boolean;
4262
4829
  static _signedInteger: RegExp;
4263
4830
  /**
4264
4831
  * 验证是否为有符号整数
4832
+ * @example
4833
+ * ```ts
4834
+ * ValidateUtil.isSignedInteger("-12"); // true
4835
+ * ```
4265
4836
  */
4266
4837
  static isSignedInteger(input: string): boolean;
4267
4838
  static _unsignedInteger: RegExp;
4268
4839
  /**
4269
4840
  * 验证是否为无符号整数
4841
+ * @example
4842
+ * ```ts
4843
+ * ValidateUtil.isUnsignedInteger("12"); // true
4844
+ * ```
4270
4845
  */
4271
4846
  static isUnsignedInteger(input: string): boolean;
4272
4847
  static _spaceInclude: RegExp;
4273
4848
  /**
4274
4849
  * 验证是否包含空格
4850
+ * @example
4851
+ * ```ts
4852
+ * ValidateUtil.isSpaceInclude("a b"); // true
4853
+ * ```
4275
4854
  */
4276
4855
  static isSpaceInclude(input: string): boolean;
4277
4856
  static _spaceStart: RegExp;
4278
4857
  /**
4279
4858
  * 验证是否以空格开头
4859
+ * @example
4860
+ * ```ts
4861
+ * ValidateUtil.isSpaceStart(" abc"); // true
4862
+ * ```
4280
4863
  */
4281
4864
  static isSpaceStart(input: string): boolean;
4282
4865
  static _spaceEnd: RegExp;
4283
4866
  /**
4284
4867
  * 验证是否以空格结尾
4868
+ * @example
4869
+ * ```ts
4870
+ * ValidateUtil.isSpaceEnd("abc "); // true
4871
+ * ```
4285
4872
  */
4286
4873
  static isSpaceEnd(input: string): boolean;
4287
4874
  /**
4288
4875
  * 验证是否以空格开头或结尾
4876
+ * @example
4877
+ * ```ts
4878
+ * ValidateUtil.isSpaceStartOrEnd(" abc"); // true
4879
+ * ```
4289
4880
  */
4290
4881
  static isSpaceStartOrEnd(input: string): boolean;
4291
4882
  }
4292
4883
  //#endregion
4293
- export { ArrayUtil, DateTimeUtil, EnvUtil, FunctionUtil, MimeUtil, NumberUtil, ObjectUtil, StringUtil, THEME_MODE_TYPE, THEME_TYPE, ThemeUtil, TreeUtil, TypeUtil, ValidateUtil };
4884
+ export { ArrayUtil, DateTimeUtil, EnvUtil, FunctionUtil, MimeUtil, NumberUtil, ObjectUtil, StringUtil, type THEME_MODE_TYPE, type THEME_TYPE, ThemeUtil, TreeUtil, TypeUtil, ValidateUtil };