@@ -41,9 +41,9 @@ export function string(value: unknown): string {
41
41
return value ;
42
42
}
43
43
44
- export function stringUnion < T extends [ string , ... Array < string > ] > (
45
- variants : readonly [ ...T ] ,
46
- ) : Decoder < T [ number ] > {
44
+ export function stringUnion <
45
+ const T extends readonly [ string , ...Array < string > ] ,
46
+ > ( variants : T ) : Decoder < T [ number ] > {
47
47
return function stringUnionDecoder ( value : unknown ) : T [ number ] {
48
48
const str = string ( value ) ;
49
49
if ( ! variants . includes ( str ) ) {
@@ -312,9 +312,9 @@ export function fieldsUnion<T extends Record<string, Decoder<unknown>>>(
312
312
}
313
313
314
314
export function tuple < T extends Array < unknown > > (
315
- mapping : readonly [ ...{ [ P in keyof T ] : Decoder < T [ P ] > } ] ,
316
- ) : Decoder < [ ... T ] > {
317
- return function tupleDecoder ( value : unknown ) : [ ... T ] {
315
+ mapping : [ ...{ [ P in keyof T ] : Decoder < T [ P ] > } ] ,
316
+ ) : Decoder < T > {
317
+ return function tupleDecoder ( value : unknown ) : T {
318
318
const arr = unknownArray ( value ) ;
319
319
if ( arr . length !== mapping . length ) {
320
320
throw new DecoderError ( {
@@ -332,7 +332,7 @@ export function tuple<T extends Array<unknown>>(
332
332
throw DecoderError . at ( error , index ) ;
333
333
}
334
334
}
335
- return result as [ ... T ] ;
335
+ return result as T ;
336
336
} ;
337
337
}
338
338
@@ -363,9 +363,9 @@ type MultiTypeName =
363
363
| "string"
364
364
| "undefined" ;
365
365
366
- export function multi < Types extends [ MultiTypeName , ... Array < MultiTypeName > ] > (
367
- types : readonly [ ...Types ] ,
368
- ) : Decoder < Multi < Types [ number ] > > {
366
+ export function multi <
367
+ Types extends readonly [ MultiTypeName , ...Array < MultiTypeName > ] ,
368
+ > ( types : Types ) : Decoder < Multi < Types [ number ] > > {
369
369
return function multiDecoder ( value ) : Multi < Types [ number ] > {
370
370
if ( value === undefined ) {
371
371
if ( types . includes ( "undefined" ) ) {
0 commit comments