uni-types 1.0.0 → 1.2.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.
Files changed (4) hide show
  1. package/README.md +186 -171
  2. package/dist/index.d.cts +2567 -162
  3. package/dist/index.d.mts +2567 -162
  4. package/package.json +31 -1
package/dist/index.d.mts CHANGED
@@ -1,3 +1,97 @@
1
+ //#region src/brand/index.d.ts
2
+ /**
3
+ * Brand/Opaque types for nominal typing
4
+ */
5
+ /**
6
+ * Brand a type for nominal typing
7
+ * Creates a unique type that cannot be accidentally mixed with other branded types
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * type UserId = Brand<string, 'UserId'>
12
+ * type OrderId = Brand<string, 'OrderId'>
13
+ *
14
+ * const userId: UserId = 'user-123' as UserId
15
+ * const orderId: OrderId = 'order-456' as OrderId
16
+ *
17
+ * // These won't mix - type safety!
18
+ * // const wrong: OrderId = userId // Error!
19
+ * ```
20
+ */
21
+ type Brand<T, B extends string> = T & {
22
+ __brand: B;
23
+ };
24
+ /**
25
+ * Unbrand a branded type - extracts the underlying type
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * type UserId = Brand<string, 'UserId'>
30
+ * Unbrand<UserId> // string
31
+ * ```
32
+ */
33
+ type Unbrand<T> = T extends Brand<infer U, infer _> ? U : T;
34
+ /**
35
+ * Common branded types for convenience
36
+ */
37
+ type BrandedString<B extends string> = Brand<string, B>;
38
+ type BrandedNumber<B extends string> = Brand<number, B>;
39
+ //#endregion
40
+ //#region src/conditional/index.d.ts
41
+ /**
42
+ * Conditional type utilities for cleaner type logic
43
+ */
44
+ /**
45
+ * If-then-else at type level
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * If<true, string, number> // string
50
+ * If<false, string, number> // number
51
+ * ```
52
+ */
53
+ type If<C extends boolean, T, F> = C extends true ? T : F;
54
+ /**
55
+ * Not operator for boolean types
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * Not<true> // false
60
+ * Not<false> // true
61
+ * ```
62
+ */
63
+ type Not<B extends boolean> = B extends true ? false : true;
64
+ /**
65
+ * And operator for boolean types
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * And<true, true> // true
70
+ * And<true, false> // false
71
+ * ```
72
+ */
73
+ type And<A extends boolean, B extends boolean> = A extends true ? B : false;
74
+ /**
75
+ * Or operator for boolean types
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * Or<true, false> // true
80
+ * Or<false, false> // false
81
+ * ```
82
+ */
83
+ type Or<A extends boolean, B extends boolean> = A extends true ? true : B;
84
+ /**
85
+ * Type constraint assertion - ensures T extends U
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * Assert<string | number, string> // string
90
+ * Assert<string, number> // never
91
+ * ```
92
+ */
93
+ type Assert<T, U extends T> = T extends U ? T : never;
94
+ //#endregion
1
95
  //#region src/core/omit.d.ts
2
96
  /**
3
97
  * Make all properties required except specified ones
@@ -111,7 +205,7 @@ type Last<T extends readonly unknown[]> = T extends readonly [...unknown[], infe
111
205
  * Tail<[1]> // []
112
206
  * ```
113
207
  */
114
- type Tail<T extends readonly unknown[]> = T extends readonly [unknown, ...infer R] ? R : [];
208
+ type Tail$1<T extends readonly unknown[]> = T extends readonly [unknown, ...infer R] ? R : [];
115
209
  /**
116
210
  * Get all elements except the last (init)
117
211
  *
@@ -160,6 +254,109 @@ type TupleLength<T extends readonly unknown[]> = T['length'];
160
254
  */
161
255
  type IsEmptyTuple<T extends readonly unknown[]> = T extends readonly [] ? true : false;
162
256
  //#endregion
257
+ //#region src/utils/path.d.ts
258
+ type Primitive$1 = string | number | boolean | null | undefined | symbol | bigint;
259
+ type Join<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
260
+ type Prev$1 = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
261
+ /**
262
+ * Get all possible paths to nested properties
263
+ *
264
+ * @example
265
+ * ```ts
266
+ * interface Obj {
267
+ * a: {
268
+ * b: string
269
+ * c: {
270
+ * d: number
271
+ * }
272
+ * }
273
+ * }
274
+ *
275
+ * type P = Paths<Obj>
276
+ * // 'a' | 'a.b' | 'a.c' | 'a.c.d'
277
+ * ```
278
+ */
279
+ type Paths<T, D extends number = 10> = [D] extends [never] ? never : T extends Primitive$1 ? never : { [K in keyof T]: T[K] extends Primitive$1 ? `${K & string}` : Join<K, Paths<T[K], Prev$1[D]>> }[keyof T];
280
+ /**
281
+ * Get the value type at a given path
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * interface Obj {
286
+ * a: {
287
+ * b: string
288
+ * }
289
+ * }
290
+ *
291
+ * type V = PathValue<Obj, 'a.b'> // string
292
+ * ```
293
+ */
294
+ type PathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? PathValue<T[K], Rest> : never : P extends keyof T ? T[P] : never;
295
+ /**
296
+ * Split a path string into an array
297
+ *
298
+ * @example
299
+ * ```ts
300
+ * SplitPath<'a.b.c'> // ['a', 'b', 'c']
301
+ * ```
302
+ */
303
+ type SplitPath<S extends string, Acc extends string[] = []> = S extends `${infer H}.${infer T}` ? SplitPath<T, [...Acc, H]> : S extends `${infer H}` ? [...Acc, H] : Acc;
304
+ //#endregion
305
+ //#region src/deep/path.d.ts
306
+ type PathSegments<_T, P extends string> = P extends '' ? [] : SplitPath<P>;
307
+ /**
308
+ * Deep omit by path - removes properties at specified paths
309
+ *
310
+ * @example
311
+ * ```ts
312
+ * interface User {
313
+ * profile: {
314
+ * name: string
315
+ * email: string
316
+ * settings: {
317
+ * theme: string
318
+ * lang: string
319
+ * }
320
+ * }
321
+ * }
322
+ *
323
+ * DeepOmit<User, 'profile.settings'>
324
+ * // { profile: { name: string; email: string } }
325
+ * ```
326
+ */
327
+ type DeepOmit<T, P extends string> = T extends object ? P extends '' ? T : DeepOmitBySegments<T, PathSegments<T, P>> : T;
328
+ type DeepOmitBySegments<T, Segments extends string[]> = Segments extends [infer First extends string, ...infer Rest extends string[]] ? First extends keyof T ? Rest extends [] ? Omit<T, First> : { [K in keyof T]: K extends First ? DeepOmitBySegments<T[K], Rest> : T[K] } : T : T;
329
+ /**
330
+ * Deep pick by path - keeps only properties at specified paths
331
+ *
332
+ * @example
333
+ * ```ts
334
+ * interface User {
335
+ * profile: {
336
+ * name: string
337
+ * email: string
338
+ * settings: {
339
+ * theme: string
340
+ * lang: string
341
+ * }
342
+ * }
343
+ * }
344
+ *
345
+ * DeepPick<User, 'profile.name' | 'profile.settings.theme'>
346
+ * // { profile: { name: string; settings: { theme: string } } }
347
+ * ```
348
+ */
349
+ type DeepPick<T, P extends string> = T extends object ? P extends '' ? T : DeepPickBySegments<T, PathSegments<T, P>> : T;
350
+ type DeepPickBySegments<T, Segments extends string[]> = Segments extends [infer First extends string, ...infer Rest extends string[]] ? First extends keyof T ? Rest extends [] ? Pick<T, First> : { [K in First]: DeepPickBySegments<T[K], Rest> } : Record<string, never> : T;
351
+ /**
352
+ * Deep pick for union paths
353
+ */
354
+ type DeepPickPaths<T, P extends string> = P extends P ? DeepPick<T, P> : never;
355
+ /**
356
+ * Deep omit for union paths
357
+ */
358
+ type DeepOmitPaths<T, P extends string> = P extends P ? DeepOmit<T, P> : never;
359
+ //#endregion
163
360
  //#region src/deep/index.d.ts
164
361
  type BuiltIn = Date | ((...args: unknown[]) => unknown) | Map<unknown, unknown> | Set<unknown> | RegExp;
165
362
  /**
@@ -231,317 +428,2525 @@ type DeepReadonly<T> = T extends BuiltIn ? T : T extends Map<infer K, infer V> ?
231
428
  */
232
429
  type DeepMutable<T> = T extends BuiltIn ? T : T extends Map<infer K, infer V> ? Map<DeepMutable<K>, DeepMutable<V>> : T extends Set<infer V> ? Set<DeepMutable<V>> : T extends readonly (infer E)[] ? DeepMutable<E>[] : T extends object ? { -readonly [P in keyof T]: DeepMutable<T[P]> } : T;
233
430
  //#endregion
234
- //#region src/guards/index.d.ts
431
+ //#region src/ecosystem/prisma.d.ts
235
432
  /**
236
- * Check if type is an array
433
+ * Prisma ORM integration types
434
+ *
435
+ * These types help work with Prisma models and operations.
436
+ * Note: Prisma is an optional peer dependency.
437
+ */
438
+ /**
439
+ * Prisma model type helper
237
440
  *
238
441
  * @example
239
442
  * ```ts
240
- * IsArray<string[]> // true
241
- * IsArray<string> // false
443
+ * // Assuming you have a User model in Prisma
444
+ * type UserModel = PrismaModel<User>
242
445
  * ```
243
446
  */
244
- type IsArray<T> = T extends readonly unknown[] ? T extends readonly [...unknown[]] ? true : false : false;
447
+ type PrismaModel<T> = T;
245
448
  /**
246
- * Check if type is a tuple
449
+ * Prisma create input type
247
450
  *
248
451
  * @example
249
452
  * ```ts
250
- * IsTuple<[string, number]> // true
251
- * IsTuple<string[]> // false
453
+ * type CreateInput = PrismaCreateInput<User>
454
+ * // { name: string; email: string; age?: number }
252
455
  * ```
253
456
  */
254
- type IsTuple<T> = T extends readonly [unknown, ...unknown[]] ? T extends readonly unknown[] ? number extends T['length'] ? false : true : false : false;
457
+ type PrismaCreateInput<T> = { [K in keyof T as undefined extends T[K] ? never : K]: T[K] } & { [K in keyof T as undefined extends T[K] ? K : never]?: T[K] };
255
458
  /**
256
- * Check if two types are equal
459
+ * Prisma update input type
257
460
  *
258
461
  * @example
259
462
  * ```ts
260
- * IsEqual<string, string> // true
261
- * IsEqual<string, number> // false
463
+ * type UpdateInput = PrismaUpdateInput<User>
464
+ * // { name?: string; email?: string; age?: number }
262
465
  * ```
263
466
  */
264
- type IsEqual<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
265
- /**
266
- * Check if type is any
267
- */
268
- type IsAny<T> = 0 extends 1 & T ? true : false;
467
+ type PrismaUpdateInput<T> = { [K in keyof T]?: T[K] | null };
269
468
  /**
270
- * Check if type is never
469
+ * Prisma where input type for unique lookup
470
+ *
471
+ * @example
472
+ * ```ts
473
+ * type UniqueWhere = PrismaUniqueWhere<User, 'id' | 'email'>
474
+ * // { id: string } | { email: string }
475
+ * ```
271
476
  */
272
- type IsNever<T> = [T] extends [never] ? true : false;
477
+ type PrismaUniqueWhere<T, UniqueFields extends keyof T> = { [K in UniqueFields]: { [P in K]: T[P] } }[UniqueFields];
273
478
  /**
274
- * Check if type is unknown
479
+ * Prisma where input type
480
+ *
481
+ * @example
482
+ * ```ts
483
+ * type WhereInput = PrismaWhereInput<User>
484
+ * // { id?: string; name?: string; AND?: WhereInput[]; OR?: WhereInput[] }
485
+ * ```
275
486
  */
276
- type IsUnknown<T> = IsEqual<T, unknown> extends true ? IsAny<T> extends true ? false : true : false;
277
- //#endregion
278
- //#region src/infer/index.d.ts
487
+ type PrismaWhereInput<T> = Partial<T> & {
488
+ AND?: PrismaWhereInput<T>[];
489
+ OR?: PrismaWhereInput<T>[];
490
+ NOT?: PrismaWhereInput<T>[];
491
+ };
279
492
  /**
280
- * Get Promise value type (recursive unwrapping)
493
+ * Prisma order by input type
281
494
  *
282
495
  * @example
283
496
  * ```ts
284
- * Awaited<Promise<string>> // string
285
- * Awaited<Promise<Promise<number>>> // number
497
+ * type OrderBy = PrismaOrderByInput<User>
498
+ * // { name?: 'asc' | 'desc'; createdAt?: 'asc' | 'desc' }
286
499
  * ```
287
500
  */
288
- type Awaited<T> = T extends Promise<infer U> ? Awaited<U> : T;
501
+ type PrismaOrderByInput<T> = { [K in keyof T]?: 'asc' | 'desc' };
289
502
  /**
290
- * Get array element type
503
+ * Prisma select type
291
504
  *
292
505
  * @example
293
506
  * ```ts
294
- * ArrayElement<string[]> // string
295
- * ArrayElement<(number | boolean)[]> // number | boolean
507
+ * type Select = PrismaSelect<User, 'name' | 'email'>
508
+ * // { name: true; email: true }
296
509
  * ```
297
510
  */
298
- type ArrayElement<T> = T extends readonly (infer E)[] ? E : never;
511
+ type PrismaSelect<T, Keys extends keyof T = keyof T> = { [K in Keys]?: true };
299
512
  /**
300
- * Get object value type
513
+ * Prisma include type (for relations)
301
514
  *
302
515
  * @example
303
516
  * ```ts
304
- * ValueOf<{ a: string; b: number }> // string | number
517
+ * type Include = PrismaInclude<User, 'posts'>
518
+ * // { posts: true }
305
519
  * ```
306
520
  */
307
- type ValueOf<T> = T[keyof T];
521
+ type PrismaInclude<T, Keys extends keyof T = keyof T> = { [K in Keys]?: true | {
522
+ select?: Partial<T>;
523
+ } };
308
524
  /**
309
- * Get function type keys
525
+ * Extract scalar (non-relation) fields from a Prisma model
310
526
  *
311
527
  * @example
312
528
  * ```ts
313
- * interface Obj {
314
- * name: string
315
- * onClick: () => void
316
- * onChange: (v: string) => void
317
- * }
318
- * FunctionKeys<Obj> // 'onClick' | 'onChange'
529
+ * type Scalars = PrismaScalarFields<User>
530
+ * // 'id' | 'name' | 'email' | 'createdAt'
319
531
  * ```
320
532
  */
321
- type FunctionKeys<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? K : never }[keyof T];
533
+ type PrismaScalarFields<T> = { [K in keyof T]: T[K] extends Date | string | number | boolean | bigint | Buffer ? K : T[K] extends Date | string | number | boolean | bigint | Buffer | null ? K : never }[keyof T];
322
534
  /**
323
- * Get non-function type keys
535
+ * Extract relation fields from a Prisma model
324
536
  *
325
537
  * @example
326
538
  * ```ts
327
- * interface Obj {
328
- * name: string
329
- * onClick: () => void
330
- * }
331
- * NonFunctionKeys<Obj> // 'name'
539
+ * type Relations = PrismaRelationFields<User>
540
+ * // 'posts' | 'comments'
332
541
  * ```
333
542
  */
334
- type NonFunctionKeys<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? never : K }[keyof T];
543
+ type PrismaRelationFields<T> = Exclude<keyof T, PrismaScalarFields<T>>;
335
544
  /**
336
- * Get function's first parameter type
545
+ * Prisma pagination args
337
546
  */
338
- type FirstParameter<T> = T extends ((first: infer F, ...rest: any[]) => any) ? F : never;
547
+ interface PrismaPagination {
548
+ skip?: number;
549
+ take?: number;
550
+ cursor?: Record<string, unknown>;
551
+ }
339
552
  /**
340
- * Extract function properties
553
+ * Prisma find many args
341
554
  */
342
- type FunctionOnly<T> = Pick<T, FunctionKeys<T>>;
555
+ interface PrismaFindManyArgs<T> {
556
+ where?: PrismaWhereInput<T>;
557
+ orderBy?: PrismaOrderByInput<T> | PrismaOrderByInput<T>[];
558
+ skip?: number;
559
+ take?: number;
560
+ cursor?: PrismaUniqueWhere<T, keyof T>;
561
+ select?: Partial<Record<keyof T, true>>;
562
+ include?: Partial<Record<keyof T, true | object>>;
563
+ }
343
564
  /**
344
- * Extract non-function properties
565
+ * Prisma find first args
345
566
  */
346
- type DataOnly<T> = Pick<T, NonFunctionKeys<T>>;
567
+ interface PrismaFindFirstArgs<T> {
568
+ where?: PrismaWhereInput<T>;
569
+ orderBy?: PrismaOrderByInput<T> | PrismaOrderByInput<T>[];
570
+ cursor?: PrismaUniqueWhere<T, keyof T>;
571
+ select?: Partial<Record<keyof T, true>>;
572
+ include?: Partial<Record<keyof T, true | object>>;
573
+ }
574
+ /**
575
+ * Prisma find unique args
576
+ */
577
+ interface PrismaFindUniqueArgs<T, UniqueFields extends keyof T> {
578
+ where: PrismaUniqueWhere<T, UniqueFields>;
579
+ select?: Partial<Record<keyof T, true>>;
580
+ include?: Partial<Record<keyof T, true | object>>;
581
+ }
582
+ /**
583
+ * Prisma create args
584
+ */
585
+ interface PrismaCreateArgs<T> {
586
+ data: PrismaCreateInput<T>;
587
+ select?: Partial<Record<keyof T, true>>;
588
+ include?: Partial<Record<keyof T, true | object>>;
589
+ }
590
+ /**
591
+ * Prisma update args
592
+ */
593
+ interface PrismaUpdateArgs<T, UniqueFields extends keyof T> {
594
+ where: PrismaUniqueWhere<T, UniqueFields>;
595
+ data: PrismaUpdateInput<T>;
596
+ select?: Partial<Record<keyof T, true>>;
597
+ include?: Partial<Record<keyof T, true | object>>;
598
+ }
599
+ /**
600
+ * Prisma delete args
601
+ */
602
+ interface PrismaDeleteArgs<T, UniqueFields extends keyof T> {
603
+ where: PrismaUniqueWhere<T, UniqueFields>;
604
+ select?: Partial<Record<keyof T, true>>;
605
+ include?: Partial<Record<keyof T, true | object>>;
606
+ }
607
+ /**
608
+ * Prisma upsert args
609
+ */
610
+ interface PrismaUpsertArgs<T, UniqueFields extends keyof T> {
611
+ where: PrismaUniqueWhere<T, UniqueFields>;
612
+ create: PrismaCreateInput<T>;
613
+ update: PrismaUpdateInput<T>;
614
+ select?: Partial<Record<keyof T, true>>;
615
+ include?: Partial<Record<keyof T, true | object>>;
616
+ }
617
+ /**
618
+ * Prisma count args
619
+ */
620
+ interface PrismaCountArgs<T> {
621
+ where?: PrismaWhereInput<T>;
622
+ select?: Partial<Record<keyof T, true>>;
623
+ }
624
+ /**
625
+ * Prisma aggregate args
626
+ */
627
+ interface PrismaAggregateArgs<T> {
628
+ where?: PrismaWhereInput<T>;
629
+ orderBy?: PrismaOrderByInput<T> | PrismaOrderByInput<T>[];
630
+ skip?: number;
631
+ take?: number;
632
+ _count?: true | {
633
+ _all?: true;
634
+ } | Partial<Record<keyof T, true>>;
635
+ _avg?: Partial<Record<keyof T, true>>;
636
+ _sum?: Partial<Record<keyof T, true>>;
637
+ _min?: Partial<Record<keyof T, true>>;
638
+ _max?: Partial<Record<keyof T, true>>;
639
+ }
640
+ /**
641
+ * Prisma group by args
642
+ */
643
+ interface PrismaGroupByArgs<T> {
644
+ where?: PrismaWhereInput<T>;
645
+ orderBy?: PrismaOrderByInput<T> | PrismaOrderByInput<T>[];
646
+ by: (keyof T)[];
647
+ having?: PrismaWhereInput<T>;
648
+ take?: number;
649
+ skip?: number;
650
+ _count?: true | {
651
+ _all?: true;
652
+ } | Partial<Record<keyof T, true>>;
653
+ _avg?: Partial<Record<keyof T, true>>;
654
+ _sum?: Partial<Record<keyof T, true>>;
655
+ _min?: Partial<Record<keyof T, true>>;
656
+ _max?: Partial<Record<keyof T, true>>;
657
+ }
347
658
  //#endregion
348
- //#region src/utils/path.d.ts
349
- type Primitive = string | number | boolean | null | undefined | symbol | bigint;
350
- type Join<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
351
- type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
659
+ //#region src/ecosystem/react.d.ts
352
660
  /**
353
- * Get all possible paths to nested properties
661
+ * React component props utilities
662
+ *
663
+ * These types help work with React component props.
664
+ * Note: React is an optional peer dependency.
665
+ */
666
+ /**
667
+ * Extract props from a React component
354
668
  *
355
669
  * @example
356
- * ```ts
357
- * interface Obj {
358
- * a: {
359
- * b: string
360
- * c: {
361
- * d: number
362
- * }
363
- * }
364
- * }
670
+ * ```tsx
671
+ * import type { ComponentProps } from 'uni-types'
365
672
  *
366
- * type P = Paths<Obj>
367
- * // 'a' | 'a.b' | 'a.c' | 'a.c.d'
673
+ * type ButtonProps = ComponentProps<'button'>
674
+ * type InputProps = ComponentProps<'input'>
368
675
  * ```
369
676
  */
370
- type Paths<T, D extends number = 10> = [D] extends [never] ? never : T extends Primitive ? never : { [K in keyof T]: T[K] extends Primitive ? `${K & string}` : Join<K, Paths<T[K], Prev[D]>> }[keyof T];
677
+ type ComponentProps<T> = T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : T extends ReactComponentType<infer P> ? P : never;
371
678
  /**
372
- * Get the value type at a given path
679
+ * Get props with ref included
373
680
  *
374
681
  * @example
375
- * ```ts
376
- * interface Obj {
377
- * a: {
378
- * b: string
379
- * }
380
- * }
381
- *
382
- * type V = PathValue<Obj, 'a.b'> // string
682
+ * ```tsx
683
+ * type ButtonPropsWithRef = ComponentPropsWithRef<'button'>
383
684
  * ```
384
685
  */
385
- type PathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? PathValue<T[K], Rest> : never : P extends keyof T ? T[P] : never;
686
+ type ComponentPropsWithRef<T> = T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] & {
687
+ ref?: unknown;
688
+ } : T extends ReactComponentType<infer P> ? P & {
689
+ ref?: unknown;
690
+ } : never;
386
691
  /**
387
- * Split a path string into an array
692
+ * Add children to props
388
693
  *
389
694
  * @example
390
- * ```ts
391
- * SplitPath<'a.b.c'> // ['a', 'b', 'c']
695
+ * ```tsx
696
+ * type Props = PropsWithChildren<{ name: string }>
697
+ * // { name: string; children?: React.ReactNode }
392
698
  * ```
393
699
  */
394
- type SplitPath<S extends string, Acc extends string[] = []> = S extends `${infer H}.${infer T}` ? SplitPath<T, [...Acc, H]> : S extends `${infer H}` ? [...Acc, H] : Acc;
395
- //#endregion
396
- //#region src/utils/index.d.ts
700
+ type PropsWithChildren<P = unknown> = P & {
701
+ children?: ReactNode;
702
+ };
397
703
  /**
398
- * Merge two types (latter overrides former)
704
+ * Remove children from props
399
705
  *
400
706
  * @example
401
- * ```ts
402
- * Merge<{ a: string; b: number }, { b: boolean; c: string }>
403
- * // { a: string; b: boolean; c: string }
707
+ * ```tsx
708
+ * type Props = PropsWithoutChildren<{ name: string; children: ReactNode }>
709
+ * // { name: string }
404
710
  * ```
405
711
  */
406
- type Merge<T, U> = Omit<T, keyof U> & U;
712
+ type PropsWithoutChildren<P> = Omit<P, 'children'>;
407
713
  /**
408
- * Non null/undefined
714
+ * Extract the prop types from a component
409
715
  *
410
716
  * @example
411
- * ```ts
412
- * NonNullable<string | null | undefined> // string
717
+ * ```tsx
718
+ * const MyComponent = (props: { name: string; age: number }) => null
719
+ * type Props = ExtractPropTypes<typeof MyComponent>
720
+ * // { name: string; age: number }
413
721
  * ```
414
722
  */
415
- type NonNullable<T> = T & {};
723
+ type ExtractPropTypes<T> = T extends ReactComponentType<infer P> ? P : never;
416
724
  /**
417
- * Exclusive properties (only one can be selected)
725
+ * Get required props from a component
418
726
  *
419
727
  * @example
420
- * ```ts
421
- * type Result = Exclusive<{ type: 'a'; valueA: string } | { type: 'b'; valueB: number }, 'type'>
422
- * // Only type: 'a' or type: 'b' can be selected
728
+ * ```tsx
729
+ * interface Props {
730
+ * name: string // required
731
+ * age?: number // optional
732
+ * onChange?: () => void
733
+ * }
734
+ *
735
+ * type Required = RequiredProps<Props>
736
+ * // 'name'
423
737
  * ```
424
738
  */
425
- type Exclusive<T, K extends keyof T> = T extends unknown ? Omit<T, K> & { [P in K]?: never } : never;
739
+ type RequiredProps<P> = { [K in keyof P]-?: {} extends Pick<P, K> ? never : K }[keyof P];
426
740
  /**
427
- * Remove null and undefined from all properties
741
+ * Get optional props from a component
742
+ *
743
+ * @example
744
+ * ```tsx
745
+ * interface Props {
746
+ * name: string // required
747
+ * age?: number // optional
748
+ * onChange?: () => void
749
+ * }
750
+ *
751
+ * type Optional = OptionalProps<Props>
752
+ * // 'age' | 'onChange'
753
+ * ```
428
754
  */
429
- type NoNullish<T> = { [K in keyof T]: NonNullable<T[K]> };
755
+ type OptionalProps<P> = { [K in keyof P]-?: {} extends Pick<P, K> ? K : never }[keyof P];
430
756
  /**
431
- * Make all properties optional while preserving undefined/null values
757
+ * Props for forward ref components
758
+ *
759
+ * @example
760
+ * ```tsx
761
+ * type InputProps = ForwardRefProps<'input'>
762
+ * ```
432
763
  */
433
- type LoosePartial<T> = { [P in keyof T]?: T[P] };
764
+ type ForwardRefProps<T extends keyof JSX.IntrinsicElements> = ComponentProps<T> & {
765
+ ref?: unknown;
766
+ };
434
767
  /**
435
- * Literal types
768
+ * Merge props with default props
769
+ *
770
+ * @example
771
+ * ```tsx
772
+ * interface Props {
773
+ * size?: 'sm' | 'md' | 'lg'
774
+ * variant?: 'primary' | 'secondary'
775
+ * }
776
+ *
777
+ * type WithDefaults = MergeDefaultProps<Props, { size: 'md' }>
778
+ * // size becomes optional with default 'md'
779
+ * ```
436
780
  */
437
- type Literal = string | number | boolean | undefined | null | void | bigint;
781
+ type MergeDefaultProps<P, D extends Partial<P>> = Omit<P, keyof D> & { [K in keyof D]?: P extends Record<K, infer V> ? V : D[K] };
438
782
  /**
439
- * Exact literal types
783
+ * Props with style
440
784
  */
441
- type LiteralString<T extends string> = T;
442
- type LiteralNumber<T extends number> = T;
443
- type LiteralBoolean<T extends boolean> = T;
785
+ type PropsWithStyle<P = unknown> = P & {
786
+ style?: CSSProperties;
787
+ };
444
788
  /**
445
- * Nullable type
789
+ * Props with className
446
790
  */
447
- type Nullable<T> = T | null;
791
+ type PropsWithClassName<P = unknown> = P & {
792
+ className?: string;
793
+ };
448
794
  /**
449
- * Optional type
795
+ * Props with style and className
450
796
  */
451
- type Optional<T> = T | undefined;
797
+ type PropsWithStyleAndClassName<P = unknown> = P & {
798
+ style?: CSSProperties;
799
+ className?: string;
800
+ };
452
801
  /**
453
- * Maybe type (nullable and optional)
802
+ * Event handler type
454
803
  */
455
- type Maybe<T> = T | null | undefined;
804
+ type EventHandler<E = SyntheticEvent> = (event: E) => void;
456
805
  /**
457
- * Convert string to camelCase
806
+ * Change event handler
458
807
  */
459
- type CamelCase<S extends string> = S extends `${infer P}_${infer Q}` ? `${P}${Capitalize<CamelCase<Q>>}` : S extends `${infer P}-${infer Q}` ? `${P}${Capitalize<CamelCase<Q>>}` : S;
808
+ type ChangeEventHandler = (event: SyntheticEvent) => void;
460
809
  /**
461
- * Convert object keys to camelCase
810
+ * Mouse event handler
462
811
  */
463
- type CamelCaseKeys<T> = { [K in keyof T as CamelCase<string & K>]: T[K] };
812
+ type MouseEventHandler = (event: SyntheticEvent) => void;
464
813
  /**
465
- * Convert string to snake_case
466
- * Handles consecutive uppercase letters correctly (e.g., XMLParser -> xml_parser)
814
+ * Keyboard event handler
467
815
  */
468
- type SnakeCase<S extends string> = S extends `${infer C0}${infer C1}${infer Rest}` ? C0 extends Uppercase<C0> ? C0 extends Lowercase<C0> ? `${C0}${SnakeCase<`${C1}${Rest}`>}` : C1 extends Uppercase<C1> ? C1 extends Lowercase<C1> ? `_${Lowercase<C0>}${SnakeCase<`${C1}${Rest}`>}` : `${Lowercase<C0>}${SnakeCase<`${C1}${Rest}`>}` : `_${Lowercase<C0>}${SnakeCase<`${C1}${Rest}`>}` : `${C0}${SnakeCase<`${C1}${Rest}`>}` : S extends `${infer C}` ? C extends Uppercase<C> ? C extends Lowercase<C> ? `${C}` : `_${Lowercase<C>}` : `${C}` : S;
816
+ type KeyboardEventHandler = (event: SyntheticEvent) => void;
469
817
  /**
470
- * Convert object keys to snake_case
818
+ * Focus event handler
471
819
  */
472
- type SnakeCaseKeys<T> = { [K in keyof T as SnakeCase<string & K>]: T[K] };
820
+ type FocusEventHandler = (event: SyntheticEvent) => void;
473
821
  /**
474
- * Require at least one property
822
+ * Form event handler
475
823
  */
476
- type AtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & { [K in Keys]: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>> }[Keys];
824
+ type FormEventHandler = (event: SyntheticEvent) => void;
825
+ type ReactComponentType<P = unknown> = (props: P) => unknown;
826
+ type ReactNode = unknown;
827
+ interface SyntheticEvent {
828
+ type: string;
829
+ nativeEvent: unknown;
830
+ currentTarget: unknown;
831
+ target: unknown;
832
+ }
833
+ type CSSProperties = Record<string, string | number | undefined>;
834
+ declare namespace JSX {
835
+ type IntrinsicElements = Record<string, unknown>;
836
+ }
837
+ //#endregion
838
+ //#region src/ecosystem/trpc.d.ts
477
839
  /**
478
- * Strict extract
840
+ * tRPC integration types
841
+ *
842
+ * These types help work with tRPC routers and procedures.
843
+ * Note: tRPC is an optional peer dependency.
479
844
  */
480
- type StrictExtract<T, U extends keyof any> = T extends Record<U, any> ? T : never;
481
845
  /**
482
- * Strict exclude
846
+ * tRPC router shape
847
+ *
848
+ * @example
849
+ * ```ts
850
+ * import { initTRPC } from '@trpc/server'
851
+ *
852
+ * const t = initTRPC.create()
853
+ *
854
+ * const router = t.router({
855
+ * user: t.procedure.query(() => ({ name: 'John' })),
856
+ * post: t.procedure.query(() => ({ title: 'Hello' }))
857
+ * })
858
+ *
859
+ * type RouterShape = TRPCRouterShape<typeof router>
860
+ * ```
483
861
  */
484
- type StrictExclude<T, U extends T> = T extends U ? never : T;
862
+ type TRPCRouterShape<T> = T extends {
863
+ _def: {
864
+ router: infer R;
865
+ };
866
+ } ? R : T;
485
867
  /**
486
- * Convert union type to intersection type
868
+ * Extract input type from tRPC procedure
869
+ *
870
+ * @example
871
+ * ```ts
872
+ * const procedure = t.procedure.input(z.object({ name: z.string() }))
873
+ *
874
+ * type Input = TRPCProcedureInput<typeof procedure>
875
+ * // { name: string }
876
+ * ```
487
877
  */
488
- type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
878
+ type TRPCProcedureInput<T> = T extends {
879
+ _def: {
880
+ inputs: infer I;
881
+ };
882
+ } ? I extends [infer First, ...unknown[]] ? First : I : T extends {
883
+ _def: {
884
+ input: infer I;
885
+ };
886
+ } ? I : never;
489
887
  /**
490
- * Convert union type to tuple
888
+ * Extract output type from tRPC procedure
889
+ *
890
+ * @example
891
+ * ```ts
892
+ * const procedure = t.procedure.output(z.object({ name: z.string() }))
893
+ *
894
+ * type Output = TRPCProcedureOutput<typeof procedure>
895
+ * // { name: string }
896
+ * ```
491
897
  */
492
- type UnionToTuple<T> = UnionToIntersection<T extends unknown ? (t: T) => T : never> extends ((_: any) => infer W) ? [...UnionToTuple<Exclude<T, W>>, W] : [];
898
+ type TRPCProcedureOutput<T> = T extends {
899
+ _def: {
900
+ output: infer O;
901
+ };
902
+ } ? O : never;
493
903
  /**
494
- * Get all required keys of a type
904
+ * tRPC procedure type
905
+ */
906
+ type TRPCProcedureType = 'query' | 'mutation' | 'subscription';
907
+ /**
908
+ * Extract procedure type from tRPC procedure
909
+ */
910
+ type TRPCExtractProcedureType<T> = T extends {
911
+ _def: {
912
+ type: infer P;
913
+ };
914
+ } ? P extends TRPCProcedureType ? P : never : never;
915
+ /**
916
+ * tRPC error shape
495
917
  *
496
918
  * @example
497
919
  * ```ts
498
- * interface User {
499
- * name: string
500
- * age?: number
920
+ * type Error = TRPCErrorShape<{ message: string }>
921
+ * ```
922
+ */
923
+ interface TRPCErrorShape<T = unknown> {
924
+ message: string;
925
+ code: string;
926
+ data?: T;
927
+ }
928
+ /**
929
+ * tRPC context type
930
+ *
931
+ * @example
932
+ * ```ts
933
+ * interface Context {
934
+ * user?: { id: string }
935
+ * session: Session
501
936
  * }
502
- * RequiredKeys<User> // 'name'
937
+ *
938
+ * type AppContext = TRPCContext<Context>
503
939
  * ```
504
940
  */
505
- type RequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T];
941
+ type TRPCContext<T> = T;
506
942
  /**
507
- * Get all optional keys of a type
943
+ * tRPC middleware type
508
944
  *
509
945
  * @example
510
946
  * ```ts
511
- * interface User {
947
+ * type Middleware = TRPCMiddleware<{ user: User }>
948
+ * ```
949
+ */
950
+ type TRPCMiddleware<T = unknown> = (opts: {
951
+ ctx: T;
952
+ next: () => Promise<void>;
953
+ }) => Promise<void>;
954
+ /**
955
+ * tRPC router record
956
+ */
957
+ type TRPCRouterRecord = Record<string, unknown>;
958
+ /**
959
+ * Merge multiple tRPC routers
960
+ */
961
+ type TRPCMergeRouters<T extends TRPCRouterRecord[]> = T extends [infer First extends TRPCRouterRecord, ...infer Rest extends TRPCRouterRecord[]] ? Rest extends [] ? First : First & TRPCMergeRouters<Rest> : Record<string, never>;
962
+ /**
963
+ * tRPC procedure builder
964
+ */
965
+ interface TRPCProcedureBuilder<T = unknown> {
966
+ _def: {
967
+ input: T;
968
+ output: unknown;
969
+ type: TRPCProcedureType;
970
+ };
971
+ }
972
+ /**
973
+ * Get all query procedures from router
974
+ */
975
+ type TRPCQueries<T> = T extends object ? { [K in keyof T]: T[K] extends {
976
+ _def: {
977
+ type: 'query';
978
+ };
979
+ } ? K : never }[keyof T] : never;
980
+ /**
981
+ * Get all mutation procedures from router
982
+ */
983
+ type TRPCMutations<T> = T extends object ? { [K in keyof T]: T[K] extends {
984
+ _def: {
985
+ type: 'mutation';
986
+ };
987
+ } ? K : never }[keyof T] : never;
988
+ /**
989
+ * Get all subscription procedures from router
990
+ */
991
+ type TRPCSubscriptions<T> = T extends object ? { [K in keyof T]: T[K] extends {
992
+ _def: {
993
+ type: 'subscription';
994
+ };
995
+ } ? K : never }[keyof T] : never;
996
+ /**
997
+ * tRPC client type
998
+ */
999
+ interface TRPCClient<T> {
1000
+ query: <K extends keyof T>(procedure: K, input?: unknown) => Promise<TRPCProcedureOutput<T[K]>>;
1001
+ mutate: <K extends keyof T>(procedure: K, input?: unknown) => Promise<TRPCProcedureOutput<T[K]>>;
1002
+ subscribe: <K extends keyof T>(procedure: K, input?: unknown) => Promise<void>;
1003
+ }
1004
+ /**
1005
+ * tRPC caller type
1006
+ */
1007
+ type TRPSCaller<T, Context = unknown> = (ctx: Context) => TRPCCallerRouter<T>;
1008
+ /**
1009
+ * tRPC caller router type
1010
+ */
1011
+ type TRPCCallerRouter<T> = { [K in keyof T]: TRPCProcedureCaller<T[K]> };
1012
+ /**
1013
+ * tRPC procedure caller type
1014
+ */
1015
+ type TRPCProcedureCaller<T> = (input: TRPCProcedureInput<T>) => Promise<TRPCProcedureOutput<T>>;
1016
+ //#endregion
1017
+ //#region src/ecosystem/vue.d.ts
1018
+ /**
1019
+ * Vue component props utilities
1020
+ *
1021
+ * These types help work with Vue component props.
1022
+ * Note: Vue is an optional peer dependency.
1023
+ */
1024
+ /**
1025
+ * Vue prop type definition
1026
+ *
1027
+ * @example
1028
+ * ```vue
1029
+ * <script setup lang="ts">
1030
+ * const props = defineProps<{
512
1031
  * name: string
513
1032
  * age?: number
1033
+ * }>()
1034
+ * </script>
1035
+ * ```
1036
+ */
1037
+ interface VuePropType<T> {
1038
+ type: VuePropConstructor<T>;
1039
+ required?: boolean;
1040
+ default?: T | (() => T);
1041
+ }
1042
+ /**
1043
+ * Vue prop constructor types
1044
+ */
1045
+ type VuePropConstructor<T> = (abstract new (...args: any[]) => T & object) | {
1046
+ (): T;
1047
+ } | {
1048
+ new (...args: any[]): T & object;
1049
+ };
1050
+ /**
1051
+ * Extract props from Vue component options
1052
+ *
1053
+ * @example
1054
+ * ```ts
1055
+ * interface Props {
1056
+ * title: string
1057
+ * count?: number
514
1058
  * }
515
- * OptionalKeys<User> // 'age'
1059
+ *
1060
+ * type Props = ExtractVueProps<Props>
516
1061
  * ```
517
1062
  */
518
- type OptionalKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? K : never }[keyof T];
1063
+ type ExtractVueProps<T> = T extends {
1064
+ props: infer P;
1065
+ } ? P : T;
519
1066
  /**
520
- * Get all writable (non-readonly) keys of a type
1067
+ * Vue component raw props (before normalization)
1068
+ */
1069
+ type VueRawProps = Record<string, VuePropConstructor<unknown> | VuePropType<unknown>>;
1070
+ /**
1071
+ * Normalize Vue props to TypeScript types
521
1072
  *
522
1073
  * @example
523
1074
  * ```ts
524
- * interface User {
525
- * name: string
526
- * readonly age: number
1075
+ * const props = {
1076
+ * name: String,
1077
+ * age: { type: Number, required: false }
527
1078
  * }
528
- * WritableKeys<User> // 'name'
1079
+ *
1080
+ * type Normalized = NormalizeVueProps<typeof props>
1081
+ * // { name: string; age?: number }
529
1082
  * ```
530
1083
  */
531
- type WritableKeys<T> = { [K in keyof T]: IfEquals<Readonly<Pick<T, K>>, Pick<T, K>, K, never> }[keyof T];
1084
+ type NormalizeVueProps<T extends VueRawProps> = { [K in keyof T]: T[K] extends VuePropType<infer V> ? T[K] extends {
1085
+ required: true;
1086
+ } ? V : V | undefined : T[K] extends VuePropConstructor<infer V> ? V | undefined : never };
532
1087
  /**
533
- * Get all readonly keys of a type
1088
+ * Vue emit function type
1089
+ *
1090
+ * @example
1091
+ * ```vue
1092
+ * <script setup lang="ts">
1093
+ * const emit = defineEmits<{
1094
+ * change: [value: string]
1095
+ * submit: []
1096
+ * }>()
1097
+ * </script>
1098
+ * ```
1099
+ */
1100
+ type VueEmitType<T extends Record<string, unknown[]>> = { [K in keyof T]: (...args: T[K]) => void };
1101
+ /**
1102
+ * Vue model props (for v-model)
534
1103
  *
535
1104
  * @example
536
1105
  * ```ts
537
- * interface User {
538
- * name: string
539
- * readonly age: number
1106
+ * interface Props {
1107
+ * modelValue: string
1108
+ * 'onUpdate:modelValue'?: (value: string) => void
540
1109
  * }
541
- * ReadonlyKeys<User> // 'age'
1110
+ *
1111
+ * type Model = VueModelProps<'modelValue', string>
542
1112
  * ```
543
1113
  */
544
- type ReadonlyKeys<T> = { [K in keyof T]: IfEquals<Readonly<Pick<T, K>>, Pick<T, K>, never, K> }[keyof T];
545
- type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? A : B;
1114
+ type VueModelProps<K extends string, T> = { [P in K]: T } & { [P in `onUpdate:${K}`]?: (value: T) => void };
1115
+ /**
1116
+ * Vue prop with default value
1117
+ */
1118
+ interface VuePropWithDefault<T, D extends T> {
1119
+ type: VuePropConstructor<T>;
1120
+ required: false;
1121
+ default: D;
1122
+ }
1123
+ /**
1124
+ * Required Vue prop
1125
+ */
1126
+ interface RequiredVueProp<T> {
1127
+ type: VuePropConstructor<T>;
1128
+ required: true;
1129
+ }
1130
+ /**
1131
+ * Optional Vue prop
1132
+ */
1133
+ interface OptionalVueProp<T> {
1134
+ type: VuePropConstructor<T>;
1135
+ required: false;
1136
+ }
1137
+ /**
1138
+ * Vue slot type
1139
+ */
1140
+ type VueSlot<T = Record<string, unknown>> = (props: T) => unknown;
1141
+ /**
1142
+ * Vue slots type
1143
+ */
1144
+ type VueSlots<T extends Record<string, Record<string, unknown> | undefined>> = { [K in keyof T]: VueSlot<NonNullable<T[K]>> };
1145
+ /**
1146
+ * Vue expose type
1147
+ */
1148
+ type VueExpose<T extends Record<string, (...args: any[]) => any>> = T;
1149
+ /**
1150
+ * Vue injection key type
1151
+ */
1152
+ type VueInjectionKey<_T> = symbol | string;
1153
+ /**
1154
+ * Vue provide/inject type pair
1155
+ */
1156
+ interface VueProvideInjectPair<T> {
1157
+ key: VueInjectionKey<T>;
1158
+ defaultValue?: T;
1159
+ }
1160
+ /**
1161
+ * Vue computed property type
1162
+ */
1163
+ interface VueComputed<T> {
1164
+ get: () => T;
1165
+ set?: (value: T) => void;
1166
+ }
1167
+ /**
1168
+ * Vue ref type
1169
+ */
1170
+ interface VueRef<T = unknown> {
1171
+ value: T;
1172
+ }
1173
+ /**
1174
+ * Vue reactive type
1175
+ */
1176
+ type VueReactive<T extends object> = T;
1177
+ /**
1178
+ * Convert Vue props options to TypeScript type
1179
+ */
1180
+ type VuePropsToType<T extends VueRawProps> = { [K in keyof T]: T[K] extends {
1181
+ type: infer C;
1182
+ required: true;
1183
+ } ? C extends VuePropConstructor<infer V> ? V : never : T[K] extends {
1184
+ type: infer C;
1185
+ default: unknown;
1186
+ } ? C extends VuePropConstructor<infer V> ? V : never : T[K] extends VuePropConstructor<infer V> ? V | undefined : T[K] extends VuePropType<infer V> ? V | undefined : never };
1187
+ /**
1188
+ * Vue component instance type
1189
+ */
1190
+ interface VueComponentInstance<P = unknown, S = unknown> {
1191
+ $props: P;
1192
+ $slots: S;
1193
+ $emit: (event: string, ...args: unknown[]) => void;
1194
+ }
1195
+ //#endregion
1196
+ //#region src/functions/index.d.ts
1197
+ /**
1198
+ * Function type utilities
1199
+ */
1200
+ /**
1201
+ * Get function parameters as tuple
1202
+ *
1203
+ * @example
1204
+ * ```ts
1205
+ * type Fn = (a: string, b: number) => boolean
1206
+ * Parameters<Fn> // [string, number]
1207
+ * ```
1208
+ */
1209
+ type Parameters<T> = T extends ((...args: infer P) => any) ? P : never;
1210
+ /**
1211
+ * Get function return type
1212
+ *
1213
+ * @example
1214
+ * ```ts
1215
+ * type Fn = (a: string) => number
1216
+ * ReturnType<Fn> // number
1217
+ * ```
1218
+ */
1219
+ type ReturnType$1<T> = T extends ((...args: any[]) => infer R) ? R : any;
1220
+ /**
1221
+ * Get Nth parameter type (0-indexed)
1222
+ *
1223
+ * @example
1224
+ * ```ts
1225
+ * type Fn = (a: string, b: number, c: boolean) => void
1226
+ * NthParameter<Fn, 0> // string
1227
+ * NthParameter<Fn, 1> // number
1228
+ * NthParameter<Fn, 2> // boolean
1229
+ * ```
1230
+ */
1231
+ type NthParameter<T, N extends number> = T extends ((...args: infer P) => any) ? P[N] : never;
1232
+ /**
1233
+ * Extract async function return type (unwraps Promise)
1234
+ *
1235
+ * @example
1236
+ * ```ts
1237
+ * type AsyncFn = () => Promise<string>
1238
+ * AsyncReturnType<AsyncFn> // string
1239
+ * ```
1240
+ */
1241
+ type AsyncReturnType<T> = T extends ((...args: any[]) => Promise<infer R>) ? R : T extends ((...args: any[]) => infer R) ? R : never;
1242
+ /**
1243
+ * Get function this parameter type
1244
+ *
1245
+ * @example
1246
+ * ```ts
1247
+ * type Fn = (this: { x: number }) => void
1248
+ * ThisParameterType<Fn> // { x: number }
1249
+ * ```
1250
+ */
1251
+ type ThisParameterType<T> = T extends ((this: infer U, ...args: any[]) => any) ? U : unknown;
1252
+ /**
1253
+ * Omit this parameter from function type
1254
+ *
1255
+ * @example
1256
+ * ```ts
1257
+ * type Fn = (this: { x: number }, a: string) => void
1258
+ * OmitThisParameter<Fn> // (a: string) => void
1259
+ * ```
1260
+ */
1261
+ type OmitThisParameter<T> = T extends ((this: any, ...args: infer A) => infer R) ? (...args: A) => R : T;
1262
+ /**
1263
+ * Check if type is a function
1264
+ *
1265
+ * @example
1266
+ * ```ts
1267
+ * IsFunction<() => void> // true
1268
+ * IsFunction<string> // false
1269
+ * ```
1270
+ */
1271
+ type IsFunction<T> = T extends ((...args: any[]) => any) ? true : false;
1272
+ /**
1273
+ * Check if type is an async function
1274
+ *
1275
+ * @example
1276
+ * ```ts
1277
+ * IsAsyncFunction<() => Promise<string>> // true
1278
+ * IsAsyncFunction<() => string> // false
1279
+ * ```
1280
+ */
1281
+ type IsAsyncFunction<T> = T extends ((...args: any[]) => Promise<any>) ? true : false;
1282
+ /**
1283
+ * Make function parameters optional
1284
+ *
1285
+ * @example
1286
+ * ```ts
1287
+ * type Fn = (a: string, b: number) => void
1288
+ * OptionalParameters<Fn> // (a?: string, b?: number) => void
1289
+ * ```
1290
+ */
1291
+ type OptionalParameters<T> = T extends ((...args: any[]) => infer R) ? (...args: Partial<Parameters<T>>) => R : never;
1292
+ /**
1293
+ * Append a parameter to a function
1294
+ *
1295
+ * @example
1296
+ * ```ts
1297
+ * type Fn = (a: string) => void
1298
+ * AppendParameter<Fn, number> // (a: string, b: number) => void
1299
+ * ```
1300
+ */
1301
+ type AppendParameter<T, P> = T extends ((...args: infer A) => infer R) ? (...args: [...A, P]) => R : never;
1302
+ /**
1303
+ * Prepend a parameter to a function
1304
+ *
1305
+ * @example
1306
+ * ```ts
1307
+ * type Fn = (a: string) => void
1308
+ * PrependParameter<Fn, number> // (a: number, b: string) => void
1309
+ * ```
1310
+ */
1311
+ type PrependParameter<T, P> = T extends ((...args: infer A) => infer R) ? (...args: [P, ...A]) => R : never;
1312
+ //#endregion
1313
+ //#region src/guards/index.d.ts
1314
+ /**
1315
+ * Check if type is an array
1316
+ *
1317
+ * @example
1318
+ * ```ts
1319
+ * IsArray<string[]> // true
1320
+ * IsArray<string> // false
1321
+ * ```
1322
+ */
1323
+ type IsArray<T> = T extends readonly unknown[] ? T extends readonly [...unknown[]] ? true : false : false;
1324
+ /**
1325
+ * Check if type is a tuple
1326
+ *
1327
+ * @example
1328
+ * ```ts
1329
+ * IsTuple<[string, number]> // true
1330
+ * IsTuple<string[]> // false
1331
+ * ```
1332
+ */
1333
+ type IsTuple<T> = T extends readonly [unknown, ...unknown[]] ? T extends readonly unknown[] ? number extends T['length'] ? false : true : false : false;
1334
+ /**
1335
+ * Check if two types are equal
1336
+ *
1337
+ * @example
1338
+ * ```ts
1339
+ * IsEqual<string, string> // true
1340
+ * IsEqual<string, number> // false
1341
+ * ```
1342
+ */
1343
+ type IsEqual<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
1344
+ /**
1345
+ * Check if type is any
1346
+ */
1347
+ type IsAny<T> = 0 extends 1 & T ? true : false;
1348
+ /**
1349
+ * Check if type is never
1350
+ */
1351
+ type IsNever<T> = [T] extends [never] ? true : false;
1352
+ /**
1353
+ * Check if type is unknown
1354
+ */
1355
+ type IsUnknown<T> = IsEqual<T, unknown> extends true ? IsAny<T> extends true ? false : true : false;
1356
+ //#endregion
1357
+ //#region src/infer/index.d.ts
1358
+ /**
1359
+ * Get Promise value type (recursive unwrapping)
1360
+ *
1361
+ * @example
1362
+ * ```ts
1363
+ * Awaited<Promise<string>> // string
1364
+ * Awaited<Promise<Promise<number>>> // number
1365
+ * ```
1366
+ */
1367
+ type Awaited<T> = T extends Promise<infer U> ? Awaited<U> : T;
1368
+ /**
1369
+ * Get array element type
1370
+ *
1371
+ * @example
1372
+ * ```ts
1373
+ * ArrayElement<string[]> // string
1374
+ * ArrayElement<(number | boolean)[]> // number | boolean
1375
+ * ```
1376
+ */
1377
+ type ArrayElement<T> = T extends readonly (infer E)[] ? E : never;
1378
+ /**
1379
+ * Get object value type
1380
+ *
1381
+ * @example
1382
+ * ```ts
1383
+ * ValueOf<{ a: string; b: number }> // string | number
1384
+ * ```
1385
+ */
1386
+ type ValueOf<T> = T[keyof T];
1387
+ /**
1388
+ * Get function type keys
1389
+ *
1390
+ * @example
1391
+ * ```ts
1392
+ * interface Obj {
1393
+ * name: string
1394
+ * onClick: () => void
1395
+ * onChange: (v: string) => void
1396
+ * }
1397
+ * FunctionKeys<Obj> // 'onClick' | 'onChange'
1398
+ * ```
1399
+ */
1400
+ type FunctionKeys<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? K : never }[keyof T];
1401
+ /**
1402
+ * Get non-function type keys
1403
+ *
1404
+ * @example
1405
+ * ```ts
1406
+ * interface Obj {
1407
+ * name: string
1408
+ * onClick: () => void
1409
+ * }
1410
+ * NonFunctionKeys<Obj> // 'name'
1411
+ * ```
1412
+ */
1413
+ type NonFunctionKeys<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? never : K }[keyof T];
1414
+ /**
1415
+ * Get function's first parameter type
1416
+ */
1417
+ type FirstParameter<T> = T extends ((first: infer F, ...rest: any[]) => any) ? F : never;
1418
+ /**
1419
+ * Extract function properties
1420
+ */
1421
+ type FunctionOnly<T> = Pick<T, FunctionKeys<T>>;
1422
+ /**
1423
+ * Extract non-function properties
1424
+ */
1425
+ type DataOnly<T> = Pick<T, NonFunctionKeys<T>>;
1426
+ //#endregion
1427
+ //#region src/utils/index.d.ts
1428
+ /**
1429
+ * Merge two types (latter overrides former)
1430
+ *
1431
+ * @example
1432
+ * ```ts
1433
+ * Merge<{ a: string; b: number }, { b: boolean; c: string }>
1434
+ * // { a: string; b: boolean; c: string }
1435
+ * ```
1436
+ */
1437
+ type Merge<T, U> = Omit<T, keyof U> & U;
1438
+ /**
1439
+ * Non null/undefined
1440
+ *
1441
+ * @example
1442
+ * ```ts
1443
+ * NonNullable<string | null | undefined> // string
1444
+ * ```
1445
+ */
1446
+ type NonNullable$1<T> = T & {};
1447
+ /**
1448
+ * Exclusive properties (only one can be selected)
1449
+ *
1450
+ * @example
1451
+ * ```ts
1452
+ * type Result = Exclusive<{ type: 'a'; valueA: string } | { type: 'b'; valueB: number }, 'type'>
1453
+ * // Only type: 'a' or type: 'b' can be selected
1454
+ * ```
1455
+ */
1456
+ type Exclusive<T, K extends keyof T> = T extends unknown ? Omit<T, K> & { [P in K]?: never } : never;
1457
+ /**
1458
+ * Remove null and undefined from all properties
1459
+ */
1460
+ type NoNullish<T> = { [K in keyof T]: NonNullable$1<T[K]> };
1461
+ /**
1462
+ * Make all properties optional while preserving undefined/null values
1463
+ */
1464
+ type LoosePartial<T> = { [P in keyof T]?: T[P] };
1465
+ /**
1466
+ * Literal types
1467
+ */
1468
+ type Literal = string | number | boolean | undefined | null | void | bigint;
1469
+ /**
1470
+ * Exact literal types
1471
+ */
1472
+ type LiteralString<T extends string> = T;
1473
+ type LiteralNumber<T extends number> = T;
1474
+ type LiteralBoolean<T extends boolean> = T;
1475
+ /**
1476
+ * Nullable type
1477
+ */
1478
+ type Nullable<T> = T | null;
1479
+ /**
1480
+ * Optional type
1481
+ */
1482
+ type Optional<T> = T | undefined;
1483
+ /**
1484
+ * Maybe type (nullable and optional)
1485
+ */
1486
+ type Maybe<T> = T | null | undefined;
1487
+ /**
1488
+ * Convert string to camelCase
1489
+ */
1490
+ type CamelCase<S extends string> = S extends `${infer P}_${infer Q}` ? `${P}${Capitalize<CamelCase<Q>>}` : S extends `${infer P}-${infer Q}` ? `${P}${Capitalize<CamelCase<Q>>}` : S;
1491
+ /**
1492
+ * Convert object keys to camelCase
1493
+ */
1494
+ type CamelCaseKeys<T> = { [K in keyof T as CamelCase<string & K>]: T[K] };
1495
+ /**
1496
+ * Convert string to snake_case
1497
+ * Handles consecutive uppercase letters correctly (e.g., XMLParser -> xml_parser)
1498
+ */
1499
+ type SnakeCase<S extends string> = S extends `${infer C0}${infer C1}${infer Rest}` ? C0 extends Uppercase<C0> ? C0 extends Lowercase<C0> ? `${C0}${SnakeCase<`${C1}${Rest}`>}` : C1 extends Uppercase<C1> ? C1 extends Lowercase<C1> ? `_${Lowercase<C0>}${SnakeCase<`${C1}${Rest}`>}` : `${Lowercase<C0>}${SnakeCase<`${C1}${Rest}`>}` : `_${Lowercase<C0>}${SnakeCase<`${C1}${Rest}`>}` : `${C0}${SnakeCase<`${C1}${Rest}`>}` : S extends `${infer C}` ? C extends Uppercase<C> ? C extends Lowercase<C> ? `${C}` : `_${Lowercase<C>}` : `${C}` : S;
1500
+ /**
1501
+ * Convert object keys to snake_case
1502
+ */
1503
+ type SnakeCaseKeys<T> = { [K in keyof T as SnakeCase<string & K>]: T[K] };
1504
+ /**
1505
+ * Require at least one property
1506
+ */
1507
+ type AtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & { [K in Keys]: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>> }[Keys];
1508
+ /**
1509
+ * Strict extract
1510
+ */
1511
+ type StrictExtract<T, U extends keyof any> = T extends Record<U, any> ? T : never;
1512
+ /**
1513
+ * Strict exclude
1514
+ */
1515
+ type StrictExclude<T, U extends T> = T extends U ? never : T;
1516
+ /**
1517
+ * Convert union type to intersection type
1518
+ */
1519
+ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
1520
+ /**
1521
+ * Convert union type to tuple
1522
+ */
1523
+ type UnionToTuple<T> = UnionToIntersection<T extends unknown ? (t: T) => T : never> extends ((_: any) => infer W) ? [...UnionToTuple<Exclude<T, W>>, W] : [];
1524
+ /**
1525
+ * Get all required keys of a type
1526
+ *
1527
+ * @example
1528
+ * ```ts
1529
+ * interface User {
1530
+ * name: string
1531
+ * age?: number
1532
+ * }
1533
+ * RequiredKeys<User> // 'name'
1534
+ * ```
1535
+ */
1536
+ type RequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T];
1537
+ /**
1538
+ * Get all optional keys of a type
1539
+ *
1540
+ * @example
1541
+ * ```ts
1542
+ * interface User {
1543
+ * name: string
1544
+ * age?: number
1545
+ * }
1546
+ * OptionalKeys<User> // 'age'
1547
+ * ```
1548
+ */
1549
+ type OptionalKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? K : never }[keyof T];
1550
+ /**
1551
+ * Get all writable (non-readonly) keys of a type
1552
+ *
1553
+ * @example
1554
+ * ```ts
1555
+ * interface User {
1556
+ * name: string
1557
+ * readonly age: number
1558
+ * }
1559
+ * WritableKeys<User> // 'name'
1560
+ * ```
1561
+ */
1562
+ type WritableKeys<T> = { [K in keyof T]: IfEquals<Readonly<Pick<T, K>>, Pick<T, K>, K, never> }[keyof T];
1563
+ /**
1564
+ * Get all readonly keys of a type
1565
+ *
1566
+ * @example
1567
+ * ```ts
1568
+ * interface User {
1569
+ * name: string
1570
+ * readonly age: number
1571
+ * }
1572
+ * ReadonlyKeys<User> // 'age'
1573
+ * ```
1574
+ */
1575
+ type ReadonlyKeys<T> = { [K in keyof T]: IfEquals<Readonly<Pick<T, K>>, Pick<T, K>, never, K> }[keyof T];
1576
+ type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? A : B;
1577
+ //#endregion
1578
+ //#region src/keys/index.d.ts
1579
+ /**
1580
+ * Get all keys as literal union
1581
+ *
1582
+ * @example
1583
+ * ```ts
1584
+ * Keys<{ a: string; b: number }> // 'a' | 'b'
1585
+ * ```
1586
+ */
1587
+ type Keys<T> = keyof T;
1588
+ /**
1589
+ * Rename object keys based on a mapping
1590
+ *
1591
+ * @example
1592
+ * ```ts
1593
+ * RenameKeys<{ oldName: string }, { oldName: 'newName' }>
1594
+ * // { newName: string }
1595
+ * ```
1596
+ */
1597
+ type RenameKeys<T, M extends Record<string, string>> = { [K in keyof T as K extends keyof M ? M[K] : K]: T[K] };
1598
+ /**
1599
+ * Prefix all keys with a string
1600
+ *
1601
+ * @example
1602
+ * ```ts
1603
+ * PrefixKeys<{ a: string; b: number }, 'data'>
1604
+ * // { dataA: string; dataB: number }
1605
+ * ```
1606
+ */
1607
+ type PrefixKeys<T, P extends string> = { [K in keyof T as `${P}${Capitalize<K & string>}`]: T[K] };
1608
+ /**
1609
+ * Suffix all keys with a string
1610
+ *
1611
+ * @example
1612
+ * ```ts
1613
+ * SuffixKeys<{ a: string; b: number }, 'Data'>
1614
+ * // { aData: string; bData: number }
1615
+ * ```
1616
+ */
1617
+ type SuffixKeys<T, S extends string> = { [K in keyof T as `${K & string}${S}`]: T[K] };
1618
+ /**
1619
+ * Convert keys to PascalCase
1620
+ *
1621
+ * @example
1622
+ * ```ts
1623
+ * PascalCaseKeys<{ helloWorld: string }>
1624
+ * // { HelloWorld: string }
1625
+ * ```
1626
+ */
1627
+ type PascalCaseKeys<T> = { [K in keyof T as Capitalize<CamelCase<K & string>>]: T[K] };
1628
+ /**
1629
+ * Get keys by value type
1630
+ *
1631
+ * @example
1632
+ * ```ts
1633
+ * interface User {
1634
+ * name: string
1635
+ * age: number
1636
+ * email: string
1637
+ * }
1638
+ *
1639
+ * KeysByValueType<User, string> // 'name' | 'email'
1640
+ * ```
1641
+ */
1642
+ type KeysByValueType<T, V> = { [K in keyof T]: T[K] extends V ? K : never }[keyof T];
1643
+ /**
1644
+ * Get keys that match a pattern
1645
+ *
1646
+ * @example
1647
+ * ```ts
1648
+ * interface User {
1649
+ * userName: string
1650
+ * userId: number
1651
+ * userEmail: string
1652
+ * age: number
1653
+ * }
1654
+ *
1655
+ * FilterKeys<User, `user${string}`> // 'userName' | 'userId' | 'userEmail'
1656
+ * ```
1657
+ */
1658
+ type FilterKeys<T, P extends string> = keyof T extends infer K ? K extends P ? K : never : never;
1659
+ //#endregion
1660
+ //#region src/numeric/index.d.ts
1661
+ /**
1662
+ * Numeric type operations for compile-time arithmetic
1663
+ */
1664
+ type NumberToArray<N extends number, Acc extends 0[] = []> = Acc['length'] extends N ? Acc : NumberToArray<N, [...Acc, 0]>;
1665
+ /**
1666
+ * Increment number type
1667
+ *
1668
+ * @example
1669
+ * ```ts
1670
+ * Inc<5> // 6
1671
+ * Inc<0> // 1
1672
+ * ```
1673
+ */
1674
+ type Inc<N extends number> = [...NumberToArray<N>, 0]['length'];
1675
+ /**
1676
+ * Decrement number type
1677
+ *
1678
+ * @example
1679
+ * ```ts
1680
+ * Dec<5> // 4
1681
+ * Dec<1> // 0
1682
+ * Dec<0> // 0 (clamped)
1683
+ * ```
1684
+ */
1685
+ type Dec<N extends number> = N extends 0 ? 0 : NumberToArray<N> extends [0, ...infer Rest] ? Rest['length'] : 0;
1686
+ /**
1687
+ * Add two number types
1688
+ *
1689
+ * @example
1690
+ * ```ts
1691
+ * Add<3, 4> // 7
1692
+ * Add<0, 5> // 5
1693
+ * ```
1694
+ */
1695
+ type Add<A extends number, B extends number> = [...NumberToArray<A>, ...NumberToArray<B>]['length'];
1696
+ /**
1697
+ * Subtract two number types
1698
+ *
1699
+ * @example
1700
+ * ```ts
1701
+ * Subtract<10, 3> // 7
1702
+ * Subtract<5, 10> // 0 (clamped)
1703
+ * ```
1704
+ */
1705
+ type Subtract<A extends number, B extends number> = NumberToArray<B> extends [...number[], ...NumberToArray<A>] ? 0 : NumberToArray<A> extends [...NumberToArray<B>, ...infer Rest] ? Rest['length'] : 0;
1706
+ /**
1707
+ * Range of numbers from start to end (inclusive)
1708
+ * Note: Limited to small ranges due to TypeScript recursion limits
1709
+ *
1710
+ * @example
1711
+ * ```ts
1712
+ * Range<1, 5> // 1 | 2 | 3 | 4 | 5
1713
+ * Range<0, 3> // 0 | 1 | 2 | 3
1714
+ * ```
1715
+ */
1716
+ type Range<From extends number, To extends number, Acc extends number = From> = From extends To ? Acc : From extends To ? Acc : never;
1717
+ /**
1718
+ * Check if A is greater than B
1719
+ *
1720
+ * @example
1721
+ * ```ts
1722
+ * GreaterThan<5, 3> // true
1723
+ * GreaterThan<3, 5> // false
1724
+ * ```
1725
+ */
1726
+ type GreaterThan<A extends number, B extends number> = Subtract<A, B> extends 0 ? false : true;
1727
+ /**
1728
+ * Check if A is less than B
1729
+ *
1730
+ * @example
1731
+ * ```ts
1732
+ * LessThan<3, 5> // true
1733
+ * LessThan<5, 3> // false
1734
+ * ```
1735
+ */
1736
+ type LessThan<A extends number, B extends number> = Subtract<B, A> extends 0 ? false : true;
1737
+ /**
1738
+ * Maximum of two numbers
1739
+ *
1740
+ * @example
1741
+ * ```ts
1742
+ * Max<3, 5> // 5
1743
+ * Max<5, 3> // 5
1744
+ * ```
1745
+ */
1746
+ type Max<A extends number, B extends number> = GreaterThan<A, B> extends true ? A : B;
1747
+ /**
1748
+ * Minimum of two numbers
1749
+ *
1750
+ * @example
1751
+ * ```ts
1752
+ * Min<3, 5> // 3
1753
+ * Min<5, 3> // 3
1754
+ * ```
1755
+ */
1756
+ type Min<A extends number, B extends number> = LessThan<A, B> extends true ? A : B;
1757
+ //#endregion
1758
+ //#region src/path/index.d.ts
1759
+ /**
1760
+ * Enhanced path utilities with validation and array support
1761
+ */
1762
+ type Primitive = string | number | boolean | null | undefined | symbol | bigint | Date | RegExp;
1763
+ type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
1764
+ /**
1765
+ * Check if a path exists in type T
1766
+ *
1767
+ * @example
1768
+ * ```ts
1769
+ * interface Obj {
1770
+ * a: {
1771
+ * b: string
1772
+ * }
1773
+ * }
1774
+ *
1775
+ * ValidPath<Obj, 'a.b'> // true
1776
+ * ValidPath<Obj, 'a.c'> // false
1777
+ * ```
1778
+ */
1779
+ type ValidPath<T, P extends string> = T extends Primitive ? P extends '' ? true : false : P extends '' ? true : P extends `${infer K}.${infer Rest}` ? K extends keyof T ? ValidPath<T[K], Rest> : false : P extends keyof T ? true : false;
1780
+ /**
1781
+ * Get all paths including array indices
1782
+ *
1783
+ * @example
1784
+ * ```ts
1785
+ * interface Users {
1786
+ * users: { name: string }[]
1787
+ * }
1788
+ *
1789
+ * ArrayPaths<Users>
1790
+ * // 'users' | `users.${number}` | `users.${number}.name`
1791
+ * ```
1792
+ */
1793
+ type ArrayPaths<T, D extends number = 10> = [D] extends [never] ? never : T extends Primitive ? never : T extends readonly (infer E)[] ? ArrayPaths<E, Prev[D]> extends infer P ? P extends string ? `${number}` | `${number}.${P}` : `${number}` : `${number}` : { [K in keyof T]: T[K] extends readonly unknown[] ? `${K & string}` | `${K & string}.${ArrayPaths<T[K], Prev[D]>}` : T[K] extends Primitive ? `${K & string}` : `${K & string}` | `${K & string}.${ArrayPaths<T[K], Prev[D]>}` }[keyof T];
1794
+ /**
1795
+ * Get leaf node paths only (paths to primitive values)
1796
+ *
1797
+ * @example
1798
+ * ```ts
1799
+ * interface Users {
1800
+ * users: { name: string, age: number }[]
1801
+ * }
1802
+ *
1803
+ * LeafPaths<Users>
1804
+ * // `users.${number}.name` | `users.${number}.age`
1805
+ * ```
1806
+ */
1807
+ type LeafPaths<T, D extends number = 10> = [D] extends [never] ? never : T extends Primitive ? never : T extends readonly (infer E)[] ? LeafPaths<E, Prev[D]> extends infer P ? P extends string ? `${number}.${P}` : never : never : { [K in keyof T]: T[K] extends Primitive ? `${K & string}` : LeafPaths<T[K], Prev[D]> extends never ? never : `${K & string}.${LeafPaths<T[K], Prev[D]>}` }[keyof T];
1808
+ /**
1809
+ * Get the length of a path (number of segments)
1810
+ *
1811
+ * @example
1812
+ * ```ts
1813
+ * PathLength<'a.b.c'> // 3
1814
+ * PathLength<'single'> // 1
1815
+ * ```
1816
+ */
1817
+ type PathLength<P extends string> = P extends '' ? 0 : P extends `${string}.${infer Rest}` ? Increment<PathLength<Rest>> : 1;
1818
+ type Increment<N extends number, Arr extends 0[] = []> = N extends Arr['length'] ? [...Arr, 0]['length'] : Increment<N, [...Arr, 0]>;
1819
+ /**
1820
+ * Get the parent path of a given path
1821
+ *
1822
+ * @example
1823
+ * ```ts
1824
+ * ParentPath<'a.b.c'> // 'a.b'
1825
+ * ParentPath<'a'> // ''
1826
+ * ```
1827
+ */
1828
+ type ParentPath<P extends string> = P extends `${infer Head}.${infer _}` ? Head : '';
1829
+ /**
1830
+ * Get the last segment of a path
1831
+ *
1832
+ * @example
1833
+ * ```ts
1834
+ * PathLeaf<'a.b.c'> // 'c'
1835
+ * PathLeaf<'a'> // 'a'
1836
+ * ```
1837
+ */
1838
+ type PathLeaf<P extends string> = P extends `${string}.${infer Tail}` ? PathLeaf<Tail> : P;
1839
+ //#endregion
1840
+ //#region src/perf/cache.d.ts
1841
+ /**
1842
+ * Type caching utilities
1843
+ *
1844
+ * These types help cache and memoize type computations.
1845
+ */
1846
+ /**
1847
+ * Cached type - prevents re-computation
1848
+ *
1849
+ * @example
1850
+ * ```ts
1851
+ * type CachedResult = Cached<ComplexComputation>
1852
+ * ```
1853
+ */
1854
+ type Cached<T> = T extends infer U ? {
1855
+ __cached: U;
1856
+ } : never;
1857
+ /**
1858
+ * Extract cached value
1859
+ *
1860
+ * @example
1861
+ * ```ts
1862
+ * type Value = CachedValue<Cached<string>> // string
1863
+ * ```
1864
+ */
1865
+ type CachedValue<T> = T extends {
1866
+ __cached: infer U;
1867
+ } ? U : never;
1868
+ /**
1869
+ * Memoized type - remembers computation
1870
+ *
1871
+ * @example
1872
+ * ```ts
1873
+ * type Memo = Memoized<{ a: string } & { b: number }>
1874
+ * ```
1875
+ */
1876
+ type Memoized<T> = T extends infer U ? U : never;
1877
+ /**
1878
+ * Type identity - prevents structural typing
1879
+ */
1880
+ interface TypeIdentity<T> {
1881
+ __brand: T;
1882
+ }
1883
+ /**
1884
+ * Brand cache for memoization
1885
+ */
1886
+ type BrandCache<T, B extends string> = T & {
1887
+ __brandCache: B;
1888
+ };
1889
+ /**
1890
+ * Resolve brand cache
1891
+ */
1892
+ type ResolveBrandCache<T> = T extends {
1893
+ __brandCache: infer _;
1894
+ } ? Omit<T, '__brandCache'> : T;
1895
+ /**
1896
+ * Cached intersection
1897
+ */
1898
+ type CachedIntersection<A, B> = Cached<A & B>;
1899
+ /**
1900
+ * Cached union
1901
+ */
1902
+ type CachedUnion<A, B> = Cached<A | B>;
1903
+ /**
1904
+ * Cached keyof
1905
+ */
1906
+ type CachedKeyOf<T> = Cached<keyof T>;
1907
+ /**
1908
+ * Cached property access
1909
+ */
1910
+ type CachedProperty<T, K extends keyof T> = Cached<T[K]>;
1911
+ /**
1912
+ * Type computation cache key
1913
+ */
1914
+ type CacheKey<T> = symbol & {
1915
+ __cacheKey: T;
1916
+ };
1917
+ /**
1918
+ * Cache entry
1919
+ */
1920
+ interface CacheEntry<K, V> {
1921
+ key: K;
1922
+ value: V;
1923
+ timestamp: number;
1924
+ }
1925
+ /**
1926
+ * Type cache structure
1927
+ */
1928
+ type TypeCache<T extends Record<string, unknown>> = { [K in keyof T]: Cached<T[K]> };
1929
+ /**
1930
+ * Flush cache - force re-computation
1931
+ */
1932
+ type FlushCache<T> = T extends Cached<infer U> ? U : T;
1933
+ //#endregion
1934
+ //#region src/perf/lazy.d.ts
1935
+ /**
1936
+ * Lazy type evaluation utilities
1937
+ *
1938
+ * These types help defer type evaluation for better compilation performance.
1939
+ */
1940
+ /**
1941
+ * Lazy type wrapper - defers type evaluation
1942
+ *
1943
+ * @example
1944
+ * ```ts
1945
+ * // Instead of complex immediate evaluation
1946
+ * type Result = Lazy<ComplexUnion>
1947
+ * ```
1948
+ */
1949
+ type Lazy<T> = () => T;
1950
+ /**
1951
+ * Force evaluate a lazy type
1952
+ *
1953
+ * @example
1954
+ * ```ts
1955
+ * type Deferred = Lazy<string>
1956
+ * type Evaluated = ForceEvaluate<Deferred> // string
1957
+ * ```
1958
+ */
1959
+ type ForceEvaluate<T> = T extends (() => infer R) ? R : T;
1960
+ /**
1961
+ * Deferred type - prevents immediate expansion
1962
+ *
1963
+ * @example
1964
+ * ```ts
1965
+ * type Complex = Deferred<{ a: string } & { b: number }>
1966
+ * ```
1967
+ */
1968
+ type Deferred<T> = T extends infer U ? U : never;
1969
+ /**
1970
+ * Thunk type - zero-argument function returning a type
1971
+ *
1972
+ * @example
1973
+ * ```ts
1974
+ * type StringThunk = Thunk<string>
1975
+ * // () => string
1976
+ * ```
1977
+ */
1978
+ type Thunk<T> = () => T;
1979
+ /**
1980
+ * Lazy property access
1981
+ *
1982
+ * @example
1983
+ * ```ts
1984
+ * type Props = { a: string; b: number; c: boolean }
1985
+ * type LazyA = LazyKey<Props, 'a'> // () => Props['a']
1986
+ * ```
1987
+ */
1988
+ type LazyKey<T, K extends keyof T> = () => T[K];
1989
+ /**
1990
+ * Lazy conditional - defers conditional evaluation
1991
+ *
1992
+ * @example
1993
+ * ```ts
1994
+ * type Cond = LazyConditional<true, string, number>
1995
+ * // () => string
1996
+ * ```
1997
+ */
1998
+ type LazyConditional<C extends boolean, T, F> = C extends true ? () => T : () => F;
1999
+ /**
2000
+ * Lazy array element
2001
+ */
2002
+ type LazyArrayElement<T> = T extends readonly (infer E)[] ? () => E : never;
2003
+ /**
2004
+ * Lazy promise unwrap
2005
+ */
2006
+ type LazyAwaited<T> = T extends PromiseLike<infer U> ? () => U : () => T;
2007
+ /**
2008
+ * Lazy function return
2009
+ */
2010
+ type LazyReturnType<T> = T extends ((...args: any[]) => infer R) ? () => R : never;
2011
+ /**
2012
+ * Lazy function parameters
2013
+ */
2014
+ type LazyParameters<T> = T extends ((...args: infer P) => any) ? () => P : never;
2015
+ /**
2016
+ * Chain lazy evaluations
2017
+ */
2018
+ type LazyChain<T, F extends (value: T) => unknown> = () => ReturnType<F>;
2019
+ /**
2020
+ * Lazy map over array type
2021
+ */
2022
+ type LazyMap<T extends readonly unknown[], F extends (value: T[number]) => unknown> = { [K in keyof T]: () => ReturnType<F> };
2023
+ //#endregion
2024
+ //#region src/perf/optimize.d.ts
2025
+ /**
2026
+ * Type optimization utilities
2027
+ *
2028
+ * These types help simplify and optimize complex types for better compilation.
2029
+ */
2030
+ /**
2031
+ * Simplify complex types - flatten intersections
2032
+ *
2033
+ * @example
2034
+ * ```ts
2035
+ * type Complex = { a: string } & { b: number }
2036
+ * type Simple = Simplify<Complex>
2037
+ * // { a: string; b: number }
2038
+ * ```
2039
+ */
2040
+ type Simplify<T> = { [K in keyof T]: T[K] } & unknown;
2041
+ /**
2042
+ * Deep simplify - recursively flatten types
2043
+ *
2044
+ * @example
2045
+ * ```ts
2046
+ * type Nested = { a: { b: string } & { c: number } }
2047
+ * type Deep = DeepSimplify<Nested>
2048
+ * ```
2049
+ */
2050
+ type DeepSimplify<T> = T extends object ? T extends ((...args: any[]) => any) ? T : T extends Array<infer E> ? DeepSimplify<E>[] : { [K in keyof T]: DeepSimplify<T[K]> } : T;
2051
+ /**
2052
+ * Flatten type - remove extra intersections
2053
+ *
2054
+ * @example
2055
+ * ```ts
2056
+ * type Flat = FlattenType<{ a: string } & { b: number } & { c: boolean }>
2057
+ * // { a: string; b: number; c: boolean }
2058
+ * ```
2059
+ */
2060
+ type FlattenType<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;
2061
+ /**
2062
+ * Reduce intersection - simplify intersection types
2063
+ *
2064
+ * @example
2065
+ * ```ts
2066
+ * type Reduced = ReduceIntersection<{ a: string } & { a: string; b: number }>
2067
+ * // { a: string; b: number }
2068
+ * ```
2069
+ */
2070
+ type ReduceIntersection<T> = T extends infer U ? Simplify<U> : never;
2071
+ /**
2072
+ * Reduce union - remove duplicate union members
2073
+ *
2074
+ * @example
2075
+ * ```ts
2076
+ * type Reduced = ReduceUnion<string | number | string>
2077
+ * // string | number
2078
+ * ```
2079
+ */
2080
+ type ReduceUnion<T> = T extends infer U ? U : never;
2081
+ /**
2082
+ * Compact type - remove never and undefined from objects
2083
+ *
2084
+ * @example
2085
+ * ```ts
2086
+ * type Compacted = Compact<{ a: string; b: never; c?: undefined }>
2087
+ * // { a: string }
2088
+ * ```
2089
+ */
2090
+ type Compact<T> = { [K in keyof T as T[K] extends never ? never : undefined extends T[K] ? never : K]: T[K] };
2091
+ /**
2092
+ * Strip never from object
2093
+ *
2094
+ * @example
2095
+ * ```ts
2096
+ * type Stripped = StripNever<{ a: string; b: never; c: number }>
2097
+ * // { a: string; c: number }
2098
+ * ```
2099
+ */
2100
+ type StripNever<T> = { [K in keyof T as T[K] extends never ? never : K]: T[K] };
2101
+ /**
2102
+ * Strip undefined from object
2103
+ *
2104
+ * @example
2105
+ * ```ts
2106
+ * type Stripped = StripUndefined<{ a: string; b?: undefined; c: number }>
2107
+ * // { a: string; c: number }
2108
+ * ```
2109
+ */
2110
+ type StripUndefined<T> = { [K in keyof T as undefined extends T[K] ? never : K]: T[K] };
2111
+ /**
2112
+ * Strip null from object
2113
+ */
2114
+ type StripNull<T> = { [K in keyof T as null extends T[K] ? never : K]: T[K] };
2115
+ /**
2116
+ * Merge all - deeply merge object types
2117
+ */
2118
+ type MergeAll<T extends object[]> = T extends [infer First extends object, ...infer Rest extends object[]] ? Rest extends [] ? Simplify<First> : Simplify<First & MergeAll<Rest>> : Record<string, never>;
2119
+ /**
2120
+ * Pick non-nullable - pick only non-nullable properties
2121
+ */
2122
+ type PickNonNullable<T> = { [K in keyof T as null | undefined extends T[K] ? never : K]: T[K] };
2123
+ /**
2124
+ * Pick nullable - pick only nullable properties
2125
+ */
2126
+ type PickNullable<T> = { [K in keyof T as null | undefined extends T[K] ? K : never]: T[K] };
2127
+ /**
2128
+ * Type equivalence check (optimized)
2129
+ */
2130
+ type TypeEq<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
2131
+ /**
2132
+ * Exact type - ensure exact shape match
2133
+ */
2134
+ type ExactType<T, Shape> = T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? T : never : never;
2135
+ /**
2136
+ * Normalize - remove optional markers while preserving types
2137
+ */
2138
+ type Normalize<T> = { [K in keyof T]-?: T[K] };
2139
+ /**
2140
+ * Optionalize - make all properties optional
2141
+ */
2142
+ type Optionalize<T> = { [K in keyof T]?: T[K] };
2143
+ //#endregion
2144
+ //#region src/record/index.d.ts
2145
+ /**
2146
+ * Record and object manipulation types
2147
+ */
2148
+ /**
2149
+ * Deep nullable - make all properties nullable
2150
+ *
2151
+ * @example
2152
+ * ```ts
2153
+ * DeepNullable<{ a: { b: string } }>
2154
+ * // { a: { b: string | null } }
2155
+ * ```
2156
+ */
2157
+ type DeepNullable<T> = T extends ((...args: any[]) => any) ? T : T extends Map<infer K, infer V> ? Map<DeepNullable<K>, DeepNullable<V>> : T extends Set<infer V> ? Set<DeepNullable<V>> : T extends readonly (infer E)[] ? DeepNullable<E>[] : T extends object ? { [K in keyof T]: DeepNullable<T[K]> | null } : T | null;
2158
+ /**
2159
+ * Deep optional - make all properties optional
2160
+ *
2161
+ * @example
2162
+ * ```ts
2163
+ * DeepOptional<{ a: { b: string } }>
2164
+ * // { a?: { b?: string } }
2165
+ * ```
2166
+ */
2167
+ type DeepOptional<T> = T extends ((...args: any[]) => any) ? T : T extends Map<infer K, infer V> ? Map<DeepOptional<K>, DeepOptional<V>> : T extends Set<infer V> ? Set<DeepOptional<V>> : T extends readonly (infer E)[] ? DeepOptional<E>[] : T extends object ? { [K in keyof T]?: DeepOptional<T[K]> } : T;
2168
+ /**
2169
+ * Immutable object - deep readonly alternative
2170
+ *
2171
+ * @example
2172
+ * ```ts
2173
+ * Immutable<{ a: { b: string[] } }>
2174
+ * // { readonly a: { readonly b: readonly string[] } }
2175
+ * ```
2176
+ */
2177
+ type Immutable<T> = T extends ((...args: any[]) => any) ? T : T extends Map<infer K, infer V> ? ReadonlyMap<Immutable<K>, Immutable<V>> : T extends Set<infer V> ? ReadonlySet<Immutable<V>> : T extends readonly (infer E)[] ? readonly Immutable<E>[] : T extends object ? { readonly [K in keyof T]: Immutable<T[K]> } : T;
2178
+ /**
2179
+ * Mutable object - deep mutable alternative
2180
+ *
2181
+ * @example
2182
+ * ```ts
2183
+ * Mutable<{ readonly a: { readonly b: readonly string[] } }>
2184
+ * // { a: { b: string[] } }
2185
+ * ```
2186
+ */
2187
+ type Mutable<T> = T extends ((...args: any[]) => any) ? T : T extends Map<infer K, infer V> ? Map<Mutable<K>, Mutable<V>> : T extends Set<infer V> ? Set<Mutable<V>> : T extends readonly (infer E)[] ? Mutable<E>[] : T extends object ? { -readonly [K in keyof T]: Mutable<T[K]> } : T;
2188
+ /**
2189
+ * Deep non-nullable - remove null and undefined from all properties
2190
+ *
2191
+ * @example
2192
+ * ```ts
2193
+ * DeepNonNullable<{ a: string | null; b: number | undefined }>
2194
+ * // { a: string; b: number }
2195
+ * ```
2196
+ */
2197
+ type DeepNonNullable<T> = T extends ((...args: any[]) => any) ? T : T extends Map<infer K, infer V> ? Map<DeepNonNullable<K>, DeepNonNullable<V>> : T extends Set<infer V> ? Set<DeepNonNullable<V>> : T extends readonly (infer E)[] ? DeepNonNullable<E>[] : T extends object ? { [K in keyof T]: DeepNonNullable<NonNullable<T[K]>> } : NonNullable<T>;
2198
+ /**
2199
+ * Exact type - ensure object has exactly these keys
2200
+ *
2201
+ * @example
2202
+ * ```ts
2203
+ * Exact<{ a: string }, { a: string }> // { a: string }
2204
+ * Exact<{ a: string }, { a: string, b: number }> // never
2205
+ * ```
2206
+ */
2207
+ type Exact<T, Shape> = T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? T : never : never;
2208
+ /**
2209
+ * Make all properties non-optional
2210
+ *
2211
+ * @example
2212
+ * ```ts
2213
+ * Required<{ a?: string; b?: number }>
2214
+ * // { a: string; b: number }
2215
+ * ```
2216
+ */
2217
+ type Required$1<T> = { [K in keyof T]-?: T[K] };
2218
+ /**
2219
+ * Deep required with null/undefined handling
2220
+ *
2221
+ * @example
2222
+ * ```ts
2223
+ * DeepRequired<{ a?: { b?: string } }>
2224
+ * // { a: { b: string } }
2225
+ * ```
2226
+ */
2227
+ type DeepRequiredProperties<T> = T extends ((...args: any[]) => any) ? T : T extends Map<infer K, infer V> ? Map<DeepRequiredProperties<K>, DeepRequiredProperties<V>> : T extends Set<infer V> ? Set<DeepRequiredProperties<V>> : T extends readonly (infer E)[] ? DeepRequiredProperties<E>[] : T extends object ? { [K in keyof T]-?: DeepRequiredProperties<T[K]> } : T;
2228
+ /**
2229
+ * Object with at least the specified keys
2230
+ *
2231
+ * @example
2232
+ * ```ts
2233
+ * HasKeys<{ a: string; b: number }, 'a'>
2234
+ * // { a: string; b: number }
2235
+ * HasKeys<{ a: string }, 'b'>
2236
+ * // never
2237
+ * ```
2238
+ */
2239
+ type HasKeys<T, K extends keyof any> = K extends keyof T ? T : never;
2240
+ /**
2241
+ * Object with exactly the specified keys
2242
+ *
2243
+ * @example
2244
+ * ```ts
2245
+ * HasExactKeys<{ a: string }, 'a'>
2246
+ * // true
2247
+ * HasExactKeys<{ a: string; b: number }, 'a'>
2248
+ * // false
2249
+ * ```
2250
+ */
2251
+ type HasExactKeys<T, K extends keyof any> = keyof T extends K ? K extends keyof T ? true : false : false;
2252
+ //#endregion
2253
+ //#region src/schema/runtime.d.ts
2254
+ /**
2255
+ * Runtime type checking utilities
2256
+ */
2257
+ /**
2258
+ * Runtime type guard function type
2259
+ *
2260
+ * @example
2261
+ * ```ts
2262
+ * const isString: RuntimeGuard<string> = (value): value is string =>
2263
+ * typeof value === 'string'
2264
+ * ```
2265
+ */
2266
+ type RuntimeGuard<T> = (value: unknown) => value is T;
2267
+ /**
2268
+ * Extract the guarded type from a type guard function
2269
+ *
2270
+ * @example
2271
+ * ```ts
2272
+ * const isNumber = (value: unknown): value is number => typeof value === 'number'
2273
+ * type Num = GuardedType<typeof isNumber> // number
2274
+ * ```
2275
+ */
2276
+ type GuardedType<G> = G extends ((value: unknown) => value is infer T) ? T : never;
2277
+ /**
2278
+ * Check if a type has a runtime check function
2279
+ *
2280
+ * @example
2281
+ * ```ts
2282
+ * type A = HasRuntimeCheck<string> // true (typeof check)
2283
+ * type B = HasRuntimeCheck<object> // false (no direct check)
2284
+ * ```
2285
+ */
2286
+ type HasRuntimeCheck<T> = T extends string | number | boolean | symbol | bigint | null | undefined ? true : T extends Array<infer _> ? true : T extends Map<infer _, infer _> ? true : T extends Set<infer _> ? true : T extends Date ? true : false;
2287
+ /**
2288
+ * Primitive type guard mapping
2289
+ */
2290
+ interface PrimitiveGuardMap {
2291
+ string: (value: unknown) => value is string;
2292
+ number: (value: unknown) => value is number;
2293
+ boolean: (value: unknown) => value is boolean;
2294
+ symbol: (value: unknown) => value is symbol;
2295
+ bigint: (value: unknown) => value is bigint;
2296
+ null: (value: unknown) => value is null;
2297
+ undefined: (value: unknown) => value is undefined;
2298
+ }
2299
+ /**
2300
+ * Get primitive guard type
2301
+ */
2302
+ type PrimitiveGuard<T extends keyof PrimitiveGuardMap> = PrimitiveGuardMap[T];
2303
+ /**
2304
+ * Composite type guard for objects
2305
+ *
2306
+ * @example
2307
+ * ```ts
2308
+ * interface User {
2309
+ * name: string
2310
+ * age: number
2311
+ * }
2312
+ *
2313
+ * const isUser: CompositeGuard<User> = (value): value is User => {
2314
+ * return typeof value === 'object' && value !== null &&
2315
+ * 'name' in value && 'age' in value
2316
+ * }
2317
+ * ```
2318
+ */
2319
+ type CompositeGuard<T extends object> = (value: unknown) => value is T;
2320
+ /**
2321
+ * Array element guard
2322
+ */
2323
+ type ArrayElementGuard<T> = (value: unknown) => value is T[];
2324
+ /**
2325
+ * Create a type guard that checks for null
2326
+ */
2327
+ type NullGuard = RuntimeGuard<null>;
2328
+ /**
2329
+ * Create a type guard that checks for undefined
2330
+ */
2331
+ type UndefinedGuard = RuntimeGuard<undefined>;
2332
+ /**
2333
+ * Create a type guard that checks for null or undefined
2334
+ */
2335
+ type NullishGuard = RuntimeGuard<null | undefined>;
2336
+ /**
2337
+ * Negate a type guard
2338
+ *
2339
+ * @example
2340
+ * ```ts
2341
+ * const isNotString: NegateGuard<string> = (value): value is Exclude<unknown, string> =>
2342
+ * typeof value !== 'string'
2343
+ * ```
2344
+ */
2345
+ type NegateGuard<T> = (value: unknown) => value is Exclude<unknown, T>;
2346
+ /**
2347
+ * Combine multiple type guards (AND)
2348
+ */
2349
+ type CombinedGuard<T, U> = (value: unknown) => value is T & U;
2350
+ /**
2351
+ * Union type guard (OR)
2352
+ */
2353
+ type UnionGuard<T, U> = (value: unknown) => value is T | U;
2354
+ /**
2355
+ * Type predicate helper
2356
+ */
2357
+ type TypePredicate = (value: unknown) => boolean;
2358
+ /**
2359
+ * Assertion function type
2360
+ */
2361
+ type AssertionFunction<T> = (value: unknown) => asserts value is T;
2362
+ /**
2363
+ * Convert type to guard name mapping
2364
+ */
2365
+ type TypeToGuardKey<T> = T extends string ? 'string' : T extends number ? 'number' : T extends boolean ? 'boolean' : T extends symbol ? 'symbol' : T extends bigint ? 'bigint' : T extends null ? 'null' : T extends undefined ? 'undefined' : never;
2366
+ /**
2367
+ * Type guard for any value
2368
+ */
2369
+ type AnyGuard = RuntimeGuard<unknown>;
2370
+ //#endregion
2371
+ //#region src/schema/yup.d.ts
2372
+ /**
2373
+ * Yup schema integration types
2374
+ *
2375
+ * These types work with Yup schemas to provide type extraction and manipulation.
2376
+ * Note: Yup is an optional peer dependency.
2377
+ */
2378
+ declare const YupTypeSymbol: unique symbol;
2379
+ /**
2380
+ * Base Yup schema type stub
2381
+ */
2382
+ interface YupSchemaStub<T = unknown> {
2383
+ [YupTypeSymbol]?: T;
2384
+ }
2385
+ /**
2386
+ * Extract the output type from a Yup schema
2387
+ *
2388
+ * @example
2389
+ * ```ts
2390
+ * import * as yup from 'yup'
2391
+ *
2392
+ * const UserSchema = yup.object({
2393
+ * name: yup.string().required(),
2394
+ * age: yup.number()
2395
+ * })
2396
+ *
2397
+ * type User = YupOutput<typeof UserSchema>
2398
+ * // { name: string; age?: number | undefined }
2399
+ * ```
2400
+ */
2401
+ type YupOutput<T> = T extends {
2402
+ __outputType: infer O;
2403
+ } ? O : T extends {
2404
+ spec: object;
2405
+ } ? T : never;
2406
+ /**
2407
+ * Extract the input type from a Yup schema
2408
+ *
2409
+ * @example
2410
+ * ```ts
2411
+ * import * as yup from 'yup'
2412
+ *
2413
+ * const UserSchema = yup.object({
2414
+ * name: yup.string().required(),
2415
+ * age: yup.number()
2416
+ * })
2417
+ *
2418
+ * type UserInput = YupInput<typeof UserSchema>
2419
+ * // { name: string; age?: number | undefined }
2420
+ * ```
2421
+ */
2422
+ type YupInput<T> = T extends {
2423
+ __inputType: infer I;
2424
+ } ? I : T extends {
2425
+ spec: object;
2426
+ } ? T : never;
2427
+ /**
2428
+ * Check if a type is a Yup schema
2429
+ *
2430
+ * @example
2431
+ * ```ts
2432
+ * import * as yup from 'yup'
2433
+ *
2434
+ * type A = IsYupSchema<yup.StringSchema> // true
2435
+ * type B = IsYupSchema<string> // false
2436
+ * ```
2437
+ */
2438
+ type IsYupSchema<T> = T extends {
2439
+ spec: object;
2440
+ } ? true : T extends {
2441
+ __isYupSchema: true;
2442
+ } ? true : false;
2443
+ /**
2444
+ * Extract the inner type from Yup optional schema
2445
+ */
2446
+ type YupUnwrapOptional<T> = T extends {
2447
+ _innerType: infer I;
2448
+ } ? I : T;
2449
+ /**
2450
+ * Check if Yup schema is optional
2451
+ */
2452
+ type IsYupOptional<T> = T extends {
2453
+ spec: {
2454
+ optional: true;
2455
+ };
2456
+ } ? true : T extends {
2457
+ _nullable: true;
2458
+ } ? true : false;
2459
+ /**
2460
+ * Check if Yup schema is nullable
2461
+ */
2462
+ type IsYupNullable<T> = T extends {
2463
+ spec: {
2464
+ nullable: true;
2465
+ };
2466
+ } ? true : T extends {
2467
+ _nullable: true;
2468
+ } ? true : false;
2469
+ /**
2470
+ * Get the element type from Yup array schema
2471
+ */
2472
+ type YupArrayElement<T> = T extends {
2473
+ _subType: infer E;
2474
+ } ? E : T extends {
2475
+ innerType: infer E;
2476
+ } ? E : never;
2477
+ /**
2478
+ * Convert Yup schema to TypeScript type (alias for YupOutput)
2479
+ */
2480
+ type YupToType<T> = YupOutput<T>;
2481
+ /**
2482
+ * Get Yup schema fields from object schema
2483
+ */
2484
+ type YupFields<T> = T extends {
2485
+ fields: infer F;
2486
+ } ? F : T extends {
2487
+ _subFields: infer F;
2488
+ } ? F : never;
2489
+ /**
2490
+ * Required keys from Yup object schema
2491
+ */
2492
+ type YupRequiredKeys<T> = T extends {
2493
+ fields: infer F;
2494
+ } ? { [K in keyof F]: F[K] extends {
2495
+ spec: {
2496
+ optional: true;
2497
+ };
2498
+ } ? never : F[K] extends {
2499
+ _optional: true;
2500
+ } ? never : K }[keyof F] : never;
2501
+ /**
2502
+ * Optional keys from Yup object schema
2503
+ */
2504
+ type YupOptionalKeys<T> = T extends {
2505
+ fields: infer F;
2506
+ } ? { [K in keyof F]: F[K] extends {
2507
+ spec: {
2508
+ optional: true;
2509
+ };
2510
+ } ? K : F[K] extends {
2511
+ _optional: true;
2512
+ } ? K : never }[keyof F] : never;
2513
+ /**
2514
+ * Yup schema type names
2515
+ */
2516
+ type YupTypeNames = 'StringSchema' | 'NumberSchema' | 'BooleanSchema' | 'DateSchema' | 'ArraySchema' | 'ObjectSchema' | 'MixedSchema' | 'TupleSchema' | 'Lazy';
2517
+ /**
2518
+ * Yup validation error type
2519
+ */
2520
+ interface YupErrorType {
2521
+ name: 'ValidationError';
2522
+ value: unknown;
2523
+ path: string;
2524
+ type: string | undefined;
2525
+ errors: string[];
2526
+ inner: Array<{
2527
+ name: 'ValidationError';
2528
+ path: string;
2529
+ message: string;
2530
+ type: string | undefined;
2531
+ }>;
2532
+ }
2533
+ /**
2534
+ * Yup test config type
2535
+ */
2536
+ interface YupTestConfig<T = unknown> {
2537
+ name: string;
2538
+ message: string | ((params: {
2539
+ value: unknown;
2540
+ path: string;
2541
+ }) => string);
2542
+ test: (value: T) => boolean | Promise<boolean>;
2543
+ }
2544
+ /**
2545
+ * Yup transform function type
2546
+ */
2547
+ type YupTransform<T = unknown, R = unknown> = (value: T, originalValue: T) => R;
2548
+ //#endregion
2549
+ //#region src/schema/zod.d.ts
2550
+ /**
2551
+ * Zod schema integration types
2552
+ *
2553
+ * These types work with Zod schemas to provide type extraction and manipulation.
2554
+ * Note: Zod is an optional peer dependency.
2555
+ */
2556
+ declare const ZodTypeSymbol: unique symbol;
2557
+ /**
2558
+ * Base Zod schema type stub
2559
+ */
2560
+ interface ZodTypeStub<T = unknown> {
2561
+ [ZodTypeSymbol]?: T;
2562
+ }
2563
+ /**
2564
+ * ZodObject shape stub
2565
+ */
2566
+ type ZodObjectShapeStub = Record<string, ZodTypeStub>;
2567
+ /**
2568
+ * Extract the output type from a Zod schema
2569
+ *
2570
+ * @example
2571
+ * ```ts
2572
+ * import { z } from 'zod'
2573
+ *
2574
+ * const UserSchema = z.object({
2575
+ * name: z.string(),
2576
+ * age: z.number()
2577
+ * })
2578
+ *
2579
+ * type User = ZodOutput<typeof UserSchema>
2580
+ * // { name: string; age: number }
2581
+ * ```
2582
+ */
2583
+ type ZodOutput<T> = T extends {
2584
+ _output: infer O;
2585
+ } ? O : T extends {
2586
+ _def: {
2587
+ type: string;
2588
+ };
2589
+ } ? T : never;
2590
+ /**
2591
+ * Extract the input type from a Zod schema
2592
+ *
2593
+ * @example
2594
+ * ```ts
2595
+ * import { z } from 'zod'
2596
+ *
2597
+ * const UserSchema = z.object({
2598
+ * name: z.string(),
2599
+ * age: z.number().optional()
2600
+ * })
2601
+ *
2602
+ * type UserInput = ZodInput<typeof UserSchema>
2603
+ * // { name: string; age?: number | undefined }
2604
+ * ```
2605
+ */
2606
+ type ZodInput<T> = T extends {
2607
+ _input: infer I;
2608
+ } ? I : T extends {
2609
+ _def: {
2610
+ type: string;
2611
+ };
2612
+ } ? T : never;
2613
+ /**
2614
+ * Check if a type is a Zod schema
2615
+ *
2616
+ * @example
2617
+ * ```ts
2618
+ * import { z } from 'zod'
2619
+ *
2620
+ * type A = IsZodSchema<z.ZodString> // true
2621
+ * type B = IsZodSchema<string> // false
2622
+ * ```
2623
+ */
2624
+ type IsZodSchema<T> = T extends {
2625
+ _def: object;
2626
+ } ? true : false;
2627
+ /**
2628
+ * Extract shape from ZodObject
2629
+ *
2630
+ * @example
2631
+ * ```ts
2632
+ * import { z } from 'zod'
2633
+ *
2634
+ * const UserSchema = z.object({
2635
+ * name: z.string(),
2636
+ * age: z.number()
2637
+ * })
2638
+ *
2639
+ * type Shape = ZodShape<typeof UserSchema>
2640
+ * // { name: ZodString; age: ZodNumber }
2641
+ * ```
2642
+ */
2643
+ type ZodShape<T> = T extends {
2644
+ _def: {
2645
+ shape: () => infer S;
2646
+ };
2647
+ } ? S : T extends {
2648
+ shape: infer S;
2649
+ } ? S : never;
2650
+ /**
2651
+ * Extract the inner type from ZodOptional
2652
+ */
2653
+ type ZodUnwrapOptional<T> = T extends {
2654
+ _def: {
2655
+ innerType: infer I;
2656
+ };
2657
+ } ? I : T;
2658
+ /**
2659
+ * Extract the inner type from ZodNullable
2660
+ */
2661
+ type ZodUnwrapNullable<T> = T extends {
2662
+ _def: {
2663
+ innerType: infer I;
2664
+ };
2665
+ } ? I : T;
2666
+ /**
2667
+ * Check if Zod schema is optional
2668
+ */
2669
+ type IsZodOptional<T> = T extends {
2670
+ _def: {
2671
+ typeName: 'ZodOptional';
2672
+ };
2673
+ } ? true : false;
2674
+ /**
2675
+ * Check if Zod schema is nullable
2676
+ */
2677
+ type IsZodNullable<T> = T extends {
2678
+ _def: {
2679
+ typeName: 'ZodNullable';
2680
+ };
2681
+ } ? true : false;
2682
+ /**
2683
+ * Get the element type from ZodArray
2684
+ */
2685
+ type ZodArrayElement<T> = T extends {
2686
+ _def: {
2687
+ type: 'array';
2688
+ elementType: infer E;
2689
+ };
2690
+ } ? E : T extends {
2691
+ element: infer E;
2692
+ } ? E : never;
2693
+ /**
2694
+ * Get value type from ZodRecord
2695
+ */
2696
+ type ZodRecordValue<T> = T extends {
2697
+ _def: {
2698
+ valueType: infer V;
2699
+ };
2700
+ } ? V : never;
2701
+ /**
2702
+ * Get key and value types from ZodMap
2703
+ */
2704
+ type ZodMapEntry<T> = T extends {
2705
+ _def: {
2706
+ keyType: infer K;
2707
+ valueType: infer V;
2708
+ };
2709
+ } ? {
2710
+ key: K;
2711
+ value: V;
2712
+ } : never;
2713
+ /**
2714
+ * Convert Zod schema to TypeScript type (alias for ZodOutput)
2715
+ */
2716
+ type ZodToType<T> = ZodOutput<T>;
2717
+ /**
2718
+ * Deep partial input for Zod schemas
2719
+ */
2720
+ type ZodDeepPartialInput<T> = T extends {
2721
+ _def: {
2722
+ typeName: 'ZodObject';
2723
+ shape: () => infer S;
2724
+ };
2725
+ } ? { [K in keyof S]?: ZodDeepPartialInput<S[K]> } : T extends {
2726
+ _def: {
2727
+ typeName: 'ZodArray';
2728
+ elementType: infer E;
2729
+ };
2730
+ } ? ZodDeepPartialInput<E>[] : T extends {
2731
+ _def: {
2732
+ typeName: 'ZodOptional';
2733
+ innerType: infer I;
2734
+ };
2735
+ } ? ZodDeepPartialInput<I> | undefined : T extends {
2736
+ _def: {
2737
+ typeName: 'ZodNullable';
2738
+ innerType: infer I;
2739
+ };
2740
+ } ? ZodDeepPartialInput<I> | null : T;
2741
+ /**
2742
+ * Required keys from ZodObject schema
2743
+ */
2744
+ type ZodRequiredKeys<T> = T extends {
2745
+ _def: {
2746
+ shape: () => infer S;
2747
+ };
2748
+ } ? { [K in keyof S]: S[K] extends {
2749
+ _def: {
2750
+ typeName: 'ZodOptional';
2751
+ };
2752
+ } ? never : S[K] extends {
2753
+ _def: {
2754
+ typeName: 'ZodDefault';
2755
+ };
2756
+ } ? never : K }[keyof S] : never;
2757
+ /**
2758
+ * Optional keys from ZodObject schema
2759
+ */
2760
+ type ZodOptionalKeys<T> = T extends {
2761
+ _def: {
2762
+ shape: () => infer S;
2763
+ };
2764
+ } ? { [K in keyof S]: S[K] extends {
2765
+ _def: {
2766
+ typeName: 'ZodOptional';
2767
+ };
2768
+ } ? K : S[K] extends {
2769
+ _def: {
2770
+ typeName: 'ZodDefault';
2771
+ };
2772
+ } ? K : never }[keyof S] : never;
2773
+ /**
2774
+ * Pick properties from ZodObject schema
2775
+ */
2776
+ type ZodPick<T, K extends keyof ZodShape<T>> = T extends {
2777
+ _def: {
2778
+ shape: () => infer S;
2779
+ };
2780
+ } ? {
2781
+ _def: {
2782
+ shape: () => Pick<S, K & keyof S>;
2783
+ typeName: 'ZodObject';
2784
+ };
2785
+ } : never;
2786
+ /**
2787
+ * Omit properties from ZodObject schema
2788
+ */
2789
+ type ZodOmit<T, K extends keyof ZodShape<T>> = T extends {
2790
+ _def: {
2791
+ shape: () => infer S;
2792
+ };
2793
+ } ? {
2794
+ _def: {
2795
+ shape: () => Omit<S, K & keyof S>;
2796
+ typeName: 'ZodObject';
2797
+ };
2798
+ } : never;
2799
+ /**
2800
+ * Get the error type from ZodError
2801
+ */
2802
+ interface ZodErrorType {
2803
+ issues: Array<{
2804
+ code: string;
2805
+ message: string;
2806
+ path: (string | number)[];
2807
+ expected?: string;
2808
+ received?: string;
2809
+ }>;
2810
+ }
2811
+ /**
2812
+ * Zod schema type name mapping
2813
+ */
2814
+ type ZodTypeNames = 'ZodString' | 'ZodNumber' | 'ZodBoolean' | 'ZodNull' | 'ZodUndefined' | 'ZodAny' | 'ZodUnknown' | 'ZodNever' | 'ZodVoid' | 'ZodArray' | 'ZodObject' | 'ZodUnion' | 'ZodIntersection' | 'ZodTuple' | 'ZodRecord' | 'ZodMap' | 'ZodSet' | 'ZodDate' | 'ZodFunction' | 'ZodLazy' | 'ZodLiteral' | 'ZodEnum' | 'ZodNativeEnum' | 'ZodPromise' | 'ZodBranded' | 'ZodOptional' | 'ZodNullable' | 'ZodDefault' | 'ZodCatch';
2815
+ //#endregion
2816
+ //#region src/template/index.d.ts
2817
+ /**
2818
+ * Template literal type utilities for string manipulation
2819
+ */
2820
+ /**
2821
+ * Replace all occurrences of a substring
2822
+ *
2823
+ * @example
2824
+ * ```ts
2825
+ * ReplaceAll<'hello world world', 'world', 'there'> // 'hello there there'
2826
+ * ReplaceAll<'aaa', 'a', 'b'> // 'bbb'
2827
+ * ```
2828
+ */
2829
+ type ReplaceAll<S extends string, From extends string, To extends string> = From extends '' ? S : S extends `${infer Before}${From}${infer After}` ? `${Before}${To}${ReplaceAll<After, From, To>}` : S;
2830
+ /**
2831
+ * Replace first occurrence of a substring
2832
+ *
2833
+ * @example
2834
+ * ```ts
2835
+ * Replace<'hello world world', 'world', 'there'> // 'hello there world'
2836
+ * ```
2837
+ */
2838
+ type Replace<S extends string, From extends string, To extends string> = From extends '' ? S : S extends `${infer Before}${From}${infer After}` ? `${Before}${To}${After}` : S;
2839
+ /**
2840
+ * Trim whitespace from both ends
2841
+ *
2842
+ * @example
2843
+ * ```ts
2844
+ * Trim<' hello '> // 'hello'
2845
+ * Trim<'\n\ttext\n'> // 'text'
2846
+ * ```
2847
+ */
2848
+ type Trim<S extends string> = TrimLeft<TrimRight<S>>;
2849
+ /**
2850
+ * Trim whitespace from left
2851
+ *
2852
+ * @example
2853
+ * ```ts
2854
+ * TrimLeft<' hello'> // 'hello'
2855
+ * ```
2856
+ */
2857
+ type TrimLeft<S extends string> = S extends ` ${infer Rest}` ? TrimLeft<Rest> : S extends `\n${infer Rest}` ? TrimLeft<Rest> : S extends `\t${infer Rest}` ? TrimLeft<Rest> : S extends `\r${infer Rest}` ? TrimLeft<Rest> : S;
2858
+ /**
2859
+ * Trim whitespace from right
2860
+ *
2861
+ * @example
2862
+ * ```ts
2863
+ * TrimRight<'hello '> // 'hello'
2864
+ * ```
2865
+ */
2866
+ type TrimRight<S extends string> = S extends `${infer Rest} ` ? TrimRight<Rest> : S extends `${infer Rest}\n` ? TrimRight<Rest> : S extends `${infer Rest}\t` ? TrimRight<Rest> : S extends `${infer Rest}\r` ? TrimRight<Rest> : S;
2867
+ /**
2868
+ * Convert string to array of characters
2869
+ *
2870
+ * @example
2871
+ * ```ts
2872
+ * StringToArray<'abc'> // ['a', 'b', 'c']
2873
+ * ```
2874
+ */
2875
+ type StringToArray<S extends string, Acc extends string[] = []> = S extends `${infer First}${infer Rest}` ? StringToArray<Rest, [...Acc, First]> : Acc;
2876
+ /**
2877
+ * Capitalize all words in a string
2878
+ *
2879
+ * @example
2880
+ * ```ts
2881
+ * CapitalizeAll<'hello world'> // 'Hello World'
2882
+ * ```
2883
+ */
2884
+ type CapitalizeAll<S extends string> = S extends `${infer First} ${infer Rest}` ? `${Capitalize<First>} ${CapitalizeAll<Rest>}` : S extends `${infer First}` ? Capitalize<First> : S;
2885
+ /**
2886
+ * Uncapitalize all words in a string
2887
+ *
2888
+ * @example
2889
+ * ```ts
2890
+ * UncapitalizeAll<'Hello World'> // 'hello world'
2891
+ * ```
2892
+ */
2893
+ type UncapitalizeAll<S extends string> = S extends `${infer First} ${infer Rest}` ? `${Uncapitalize<First>} ${UncapitalizeAll<Rest>}` : S extends `${infer First}` ? Uncapitalize<First> : S;
2894
+ /**
2895
+ * Check if string starts with a prefix
2896
+ *
2897
+ * @example
2898
+ * ```ts
2899
+ * StartsWith<'hello world', 'hello'> // true
2900
+ * StartsWith<'hello world', 'world'> // false
2901
+ * ```
2902
+ */
2903
+ type StartsWith<S extends string, P extends string> = S extends `${P}${any}` ? true : false;
2904
+ /**
2905
+ * Check if string ends with a suffix
2906
+ *
2907
+ * @example
2908
+ * ```ts
2909
+ * EndsWith<'hello world', 'world'> // true
2910
+ * EndsWith<'hello world', 'hello'> // false
2911
+ * ```
2912
+ */
2913
+ type EndsWith<S extends string, P extends string> = S extends `${any}${P}` ? true : false;
2914
+ /**
2915
+ * Get string length at type level
2916
+ *
2917
+ * @example
2918
+ * ```ts
2919
+ * StringLength<'hello'> // 5
2920
+ * ```
2921
+ */
2922
+ type StringLength<S extends string, Acc extends 0[] = []> = S extends `${string}${infer Rest}` ? StringLength<Rest, [...Acc, 0]> : Acc['length'];
2923
+ /**
2924
+ * Repeat a string N times
2925
+ *
2926
+ * @example
2927
+ * ```ts
2928
+ * Repeat<'ab', 3> // 'ababab'
2929
+ * ```
2930
+ */
2931
+ type Repeat<S extends string, N extends number, Acc extends string = '', Count extends 0[] = []> = Count['length'] extends N ? Acc : Repeat<S, N, `${Acc}${S}`, [...Count, 0]>;
2932
+ /**
2933
+ * Pad string on the left
2934
+ *
2935
+ * @example
2936
+ * ```ts
2937
+ * PadStart<'5', 3, '0'> // '005'
2938
+ * ```
2939
+ */
2940
+ type PadStart<S extends string, N extends number, P extends string = ' '> = StringLength<S> extends N ? S : N extends number ? `${P}${PadStart<S, Decrement<N>, P>}` : S;
2941
+ /**
2942
+ * Pad string on the right
2943
+ *
2944
+ * @example
2945
+ * ```ts
2946
+ * PadEnd<'5', 3, '0'> // '500'
2947
+ * ```
2948
+ */
2949
+ type PadEnd<S extends string, N extends number, P extends string = ' '> = StringLength<S> extends N ? S : N extends number ? `${PadEnd<S, Decrement<N>, P>}${P}` : S;
2950
+ type Decrement<N extends number, Acc extends 0[] = []> = N extends 0 ? 0 : [...Acc, 0]['length'] extends N ? Acc['length'] : Decrement<N, [...Acc, 0]>;
546
2951
  //#endregion
547
- export { ArrayElement, AtLeastOne, Awaited, CamelCase, CamelCaseKeys, DataOnly, DeepMutable, DeepPartial, DeepReadonly, DeepRequired, Exclusive, FirstParameter, Flatten, FunctionKeys, FunctionOnly, Head, Init, IsAny, IsArray, IsEmptyTuple, IsEqual, IsNever, IsTuple, IsUnknown, Last, Literal, LiteralBoolean, LiteralNumber, LiteralString, LoosePartial, Maybe, Merge, NoNullish, NonFunctionKeys, NonNullable, Nullable, OmitPartial, OmitRequired, Optional, OptionalKeys, PathValue, Paths, PickPartial, PickRequired, ReadonlyKeys, RequiredKeys, Reverse, SnakeCase, SnakeCaseKeys, SplitPath, StrictExclude, StrictExtract, Tail, TupleLength, UnionToIntersection, UnionToTuple, ValueOf, WritableKeys };
2952
+ export { Add, And, AnyGuard, AppendParameter, ArrayElement, ArrayElementGuard, ArrayPaths, Assert, AssertionFunction, AsyncReturnType, AtLeastOne, Awaited, Brand, BrandCache, BrandedNumber, BrandedString, CacheEntry, CacheKey, Cached, CachedIntersection, CachedKeyOf, CachedProperty, CachedUnion, CachedValue, CamelCase, CamelCaseKeys, CapitalizeAll, ChangeEventHandler, CombinedGuard, Compact, ComponentProps, ComponentPropsWithRef, CompositeGuard, DataOnly, Dec, DeepMutable, DeepNonNullable, DeepNullable, DeepOmit, DeepOmitPaths, DeepOptional, DeepPartial, DeepPick, DeepPickPaths, DeepReadonly, DeepRequired, DeepRequiredProperties, DeepSimplify, Deferred, EndsWith, EventHandler, Exact, ExactType, Exclusive, ExtractPropTypes, ExtractVueProps, FilterKeys, FirstParameter, Flatten, FlattenType, FlushCache, FocusEventHandler, ForceEvaluate, FormEventHandler, ForwardRefProps, FunctionKeys, FunctionOnly, GreaterThan, GuardedType, HasExactKeys, HasKeys, HasRuntimeCheck, Head, If, Immutable, Inc, Init, IsAny, IsArray, IsAsyncFunction, IsEmptyTuple, IsEqual, IsFunction, IsNever, IsTuple, IsUnknown, IsYupNullable, IsYupOptional, IsYupSchema, IsZodNullable, IsZodOptional, IsZodSchema, KeyboardEventHandler, Keys, KeysByValueType, Last, Lazy, LazyArrayElement, LazyAwaited, LazyChain, LazyConditional, LazyKey, LazyMap, LazyParameters, LazyReturnType, LeafPaths, LessThan, Literal, LiteralBoolean, LiteralNumber, LiteralString, LoosePartial, Max, Maybe, Memoized, Merge, MergeAll, MergeDefaultProps, Min, MouseEventHandler, Mutable, NegateGuard, NoNullish, NonFunctionKeys, NonNullable$1 as NonNullable, Normalize, NormalizeVueProps, Not, NthParameter, NullGuard, Nullable, NullishGuard, OmitPartial, OmitRequired, OmitThisParameter, Optional, OptionalKeys, OptionalParameters, OptionalProps, OptionalVueProp, Optionalize, Or, PadEnd, PadStart, Parameters, ParentPath, PascalCaseKeys, PathLeaf, PathLength, PathValue, Paths, PickNonNullable, PickNullable, PickPartial, PickRequired, PrefixKeys, PrependParameter, PrimitiveGuard, PrimitiveGuardMap, PrismaAggregateArgs, PrismaCountArgs, PrismaCreateArgs, PrismaCreateInput, PrismaDeleteArgs, PrismaFindFirstArgs, PrismaFindManyArgs, PrismaFindUniqueArgs, PrismaGroupByArgs, PrismaInclude, PrismaModel, PrismaOrderByInput, PrismaPagination, PrismaRelationFields, PrismaScalarFields, PrismaSelect, PrismaUniqueWhere, PrismaUpdateArgs, PrismaUpdateInput, PrismaUpsertArgs, PrismaWhereInput, PropsWithChildren, PropsWithClassName, PropsWithStyle, PropsWithStyleAndClassName, PropsWithoutChildren, Range, ReadonlyKeys, ReduceIntersection, ReduceUnion, RenameKeys, Repeat, Replace, ReplaceAll, Required$1 as Required, RequiredKeys, RequiredProps, RequiredVueProp, ResolveBrandCache, ReturnType$1 as ReturnType, Reverse, RuntimeGuard, Simplify, SnakeCase, SnakeCaseKeys, SplitPath, StartsWith, StrictExclude, StrictExtract, StringLength, StringToArray, StripNever, StripNull, StripUndefined, Subtract, SuffixKeys, TRPCCallerRouter, TRPCClient, TRPCContext, TRPCErrorShape, TRPCExtractProcedureType, TRPCMergeRouters, TRPCMiddleware, TRPCMutations, TRPCProcedureBuilder, TRPCProcedureCaller, TRPCProcedureInput, TRPCProcedureOutput, TRPCProcedureType, TRPCQueries, TRPCRouterRecord, TRPCRouterShape, TRPCSubscriptions, TRPSCaller, Tail$1 as Tail, ThisParameterType, Thunk, Trim, TrimLeft, TrimRight, TupleLength, TypeCache, TypeEq, TypeIdentity, TypePredicate, TypeToGuardKey, Unbrand, UncapitalizeAll, UndefinedGuard, UnionGuard, UnionToIntersection, UnionToTuple, ValidPath, ValueOf, VueComponentInstance, VueComputed, VueEmitType, VueExpose, VueInjectionKey, VueModelProps, VuePropConstructor, VuePropType, VuePropWithDefault, VuePropsToType, VueProvideInjectPair, VueRawProps, VueReactive, VueRef, VueSlot, VueSlots, WritableKeys, YupArrayElement, YupErrorType, YupFields, YupInput, YupOptionalKeys, YupOutput, YupRequiredKeys, YupSchemaStub, YupTestConfig, YupToType, YupTransform, YupTypeNames, YupUnwrapOptional, ZodArrayElement, ZodDeepPartialInput, ZodErrorType, ZodInput, ZodMapEntry, ZodObjectShapeStub, ZodOmit, ZodOptionalKeys, ZodOutput, ZodPick, ZodRecordValue, ZodRequiredKeys, ZodShape, ZodToType, ZodTypeNames, ZodTypeStub, ZodUnwrapNullable, ZodUnwrapOptional };