@@ -496,7 +496,7 @@ export const dictionary = <C extends Any>(codomain: C, name?: string): Dictionar
496
496
// unions
497
497
//
498
498
499
- export class UnionType < RTS extends [ Any ] > extends Type < any , TypeOf < RTS [ '_A' ] > > {
499
+ export class UnionType < RTS extends Array < Any > > extends Type < any , TypeOf < RTS [ '_A' ] > > {
500
500
readonly _tag : 'UnionType' = 'UnionType'
501
501
constructor ( readonly types : RTS , readonly name : string = `(${ types . map ( type => type . name ) . join ( ' | ' ) } )` ) {
502
502
super (
@@ -526,18 +526,18 @@ export class UnionType<RTS extends [Any]> extends Type<any, TypeOf<RTS['_A']>> {
526
526
}
527
527
}
528
528
529
- export const union = < RTS extends [ Any ] > ( types : RTS , name ?: string ) : UnionType < RTS > => new UnionType ( types , name )
529
+ export const union = < RTS extends Array < Any > > ( types : RTS , name ?: string ) : UnionType < RTS > => new UnionType ( types , name )
530
530
531
531
//
532
532
// intersections
533
533
//
534
534
535
- export class IntersectionType < RTS extends Array < Any > , I > extends Type < any , I > {
535
+ export class IntersectionType < RTS extends Array < Any > , A > extends Type < any , A > {
536
536
readonly _tag : 'IntersectionType' = 'IntersectionType'
537
537
constructor ( readonly types : RTS , readonly name : string = `(${ types . map ( type => type . name ) . join ( ' & ' ) } )` ) {
538
538
super (
539
539
name ,
540
- ( v ) : v is I => types . every ( type => type . is ( v ) ) ,
540
+ ( v ) : v is A => types . every ( type => type . is ( v ) ) ,
541
541
( v , c ) => {
542
542
let deserialized = v
543
543
let changed = false
@@ -594,12 +594,12 @@ export function intersection<RTS extends Array<Any>>(types: RTS, name?: string):
594
594
// tuples
595
595
//
596
596
597
- export class TupleType < RTS extends Array < Any > , I > extends Type < any , I > {
597
+ export class TupleType < RTS extends Array < Any > , A > extends Type < any , A > {
598
598
readonly _tag : 'TupleType' = 'TupleType'
599
599
constructor ( readonly types : RTS , readonly name : string = `[${ types . map ( type => type . name ) . join ( ', ' ) } ]` ) {
600
600
super (
601
601
name ,
602
- ( v ) : v is I => types . every ( ( type , i ) => type . is ( v [ i ] ) ) ,
602
+ ( v ) : v is A => types . every ( ( type , i ) => type . is ( v [ i ] ) ) ,
603
603
( v , c ) =>
604
604
arrayType . validate ( v , c ) . chain ( as => {
605
605
const t : Array < any > = [ ]
0 commit comments