@@ -236,11 +236,10 @@ export type IsMatch<T, G> = T extends G ? (G extends T ? T : never) : never
236
236
* Check if a type is an exact match.
237
237
*/
238
238
239
- export type IsExactMatch < T , U > = ( < G > ( ) => G extends T ? 1 : 2 ) extends <
240
- G
241
- > ( ) => G extends U ? 1 : 2
242
- ? T
243
- : never
239
+ export type IsExactMatch < T , U > =
240
+ ( < G > ( ) => G extends T ? 1 : 2 ) extends < G > ( ) => G extends U ? 1 : 2
241
+ ? T
242
+ : never
244
243
245
244
/**
246
245
* Check if a type is a record type.
@@ -258,14 +257,14 @@ export type IsRecord<T> = T extends object
258
257
export type IsTuple < T > = T extends [ any ]
259
258
? T
260
259
: T extends [ any , any ]
261
- ? T
262
- : T extends [ any , any , any ]
263
- ? T
264
- : T extends [ any , any , any , any ]
265
- ? T
266
- : T extends [ any , any , any , any , any ]
267
- ? T
268
- : never
260
+ ? T
261
+ : T extends [ any , any , any ]
262
+ ? T
263
+ : T extends [ any , any , any , any ]
264
+ ? T
265
+ : T extends [ any , any , any , any , any ]
266
+ ? T
267
+ : never
269
268
270
269
/**
271
270
* Check if a type is a union.
@@ -342,42 +341,42 @@ export type StructSchema<T> = [T] extends [string | undefined | null]
342
341
? [ T ] extends [ IsMatch < T , string | undefined | null > ]
343
342
? null
344
343
: [ T ] extends [ IsUnion < T > ]
345
- ? EnumSchema < T >
346
- : T
344
+ ? EnumSchema < T >
345
+ : T
347
346
: [ T ] extends [ number | undefined | null ]
348
- ? [ T ] extends [ IsMatch < T , number | undefined | null > ]
349
- ? null
350
- : [ T ] extends [ IsUnion < T > ]
351
- ? EnumSchema < T >
352
- : T
353
- : [ T ] extends [ boolean ]
354
- ? [ T ] extends [ IsExactMatch < T , boolean > ]
355
- ? null
356
- : T
357
- : T extends
358
- | bigint
359
- | symbol
360
- | undefined
361
- | null
362
- | Function
363
- | Date
364
- | Error
365
- | RegExp
366
- | Map < any , any >
367
- | WeakMap < any , any >
368
- | Set < any >
369
- | WeakSet < any >
370
- | Promise < any >
371
- ? null
372
- : T extends Array < infer E >
373
- ? T extends IsTuple < T >
374
- ? null
375
- : Struct < E >
376
- : T extends object
377
- ? T extends IsRecord < T >
378
- ? null
379
- : { [ K in keyof T ] : Describe < T [ K ] > }
380
- : null
347
+ ? [ T ] extends [ IsMatch < T , number | undefined | null > ]
348
+ ? null
349
+ : [ T ] extends [ IsUnion < T > ]
350
+ ? EnumSchema < T >
351
+ : T
352
+ : [ T ] extends [ boolean ]
353
+ ? [ T ] extends [ IsExactMatch < T , boolean > ]
354
+ ? null
355
+ : T
356
+ : T extends
357
+ | bigint
358
+ | symbol
359
+ | undefined
360
+ | null
361
+ | Function
362
+ | Date
363
+ | Error
364
+ | RegExp
365
+ | Map < any , any >
366
+ | WeakMap < any , any >
367
+ | Set < any >
368
+ | WeakSet < any >
369
+ | Promise < any >
370
+ ? null
371
+ : T extends Array < infer E >
372
+ ? T extends IsTuple < T >
373
+ ? null
374
+ : Struct < E >
375
+ : T extends object
376
+ ? T extends IsRecord < T >
377
+ ? null
378
+ : { [ K in keyof T ] : Describe < T [ K ] > }
379
+ : null
381
380
382
381
/**
383
382
* A schema for tuple structs.
@@ -400,7 +399,7 @@ export type AnyStruct = Struct<any, any>
400
399
401
400
export type InferStructTuple <
402
401
Tuple extends AnyStruct [ ] ,
403
- Length extends number = Tuple [ 'length' ]
402
+ Length extends number = Tuple [ 'length' ] ,
404
403
> = Length extends Length
405
404
? number extends Length
406
405
? Tuple
@@ -410,7 +409,7 @@ type _InferTuple<
410
409
Tuple extends AnyStruct [ ] ,
411
410
Length extends number ,
412
411
Accumulated extends unknown [ ] ,
413
- Index extends number = Accumulated [ 'length' ]
412
+ Index extends number = Accumulated [ 'length' ] ,
414
413
> = Index extends Length
415
414
? Accumulated
416
415
: _InferTuple < Tuple , Length , [ ...Accumulated , Infer < Tuple [ Index ] > ] >
0 commit comments