@@ -852,3 +852,113 @@ type T83 = Eq2<false, false>; // true
852852>T83 : Symbol(T83, Decl(conditionalTypes1.ts, 223, 28))
853853>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 218, 29))
854854
855+ // Repro from #21756
856+
857+ type Foo<T> = T extends string ? boolean : number;
858+ >Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 224, 29))
859+ >T : Symbol(T, Decl(conditionalTypes1.ts, 228, 9))
860+ >T : Symbol(T, Decl(conditionalTypes1.ts, 228, 9))
861+
862+ type Bar<T> = T extends string ? boolean : number;
863+ >Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 228, 50))
864+ >T : Symbol(T, Decl(conditionalTypes1.ts, 229, 9))
865+ >T : Symbol(T, Decl(conditionalTypes1.ts, 229, 9))
866+
867+ const convert = <U>(value: Foo<U>): Bar<U> => value;
868+ >convert : Symbol(convert, Decl(conditionalTypes1.ts, 230, 5))
869+ >U : Symbol(U, Decl(conditionalTypes1.ts, 230, 17))
870+ >value : Symbol(value, Decl(conditionalTypes1.ts, 230, 20))
871+ >Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 224, 29))
872+ >U : Symbol(U, Decl(conditionalTypes1.ts, 230, 17))
873+ >Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 228, 50))
874+ >U : Symbol(U, Decl(conditionalTypes1.ts, 230, 17))
875+ >value : Symbol(value, Decl(conditionalTypes1.ts, 230, 20))
876+
877+ type Baz<T> = Foo<T>;
878+ >Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 230, 52))
879+ >T : Symbol(T, Decl(conditionalTypes1.ts, 232, 9))
880+ >Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 224, 29))
881+ >T : Symbol(T, Decl(conditionalTypes1.ts, 232, 9))
882+
883+ const convert2 = <T>(value: Foo<T>): Baz<T> => value;
884+ >convert2 : Symbol(convert2, Decl(conditionalTypes1.ts, 233, 5))
885+ >T : Symbol(T, Decl(conditionalTypes1.ts, 233, 18))
886+ >value : Symbol(value, Decl(conditionalTypes1.ts, 233, 21))
887+ >Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 224, 29))
888+ >T : Symbol(T, Decl(conditionalTypes1.ts, 233, 18))
889+ >Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 230, 52))
890+ >T : Symbol(T, Decl(conditionalTypes1.ts, 233, 18))
891+ >value : Symbol(value, Decl(conditionalTypes1.ts, 233, 21))
892+
893+ function f31<T>() {
894+ >f31 : Symbol(f31, Decl(conditionalTypes1.ts, 233, 53))
895+ >T : Symbol(T, Decl(conditionalTypes1.ts, 235, 13))
896+
897+ type T1 = T extends string ? boolean : number;
898+ >T1 : Symbol(T1, Decl(conditionalTypes1.ts, 235, 19))
899+ >T : Symbol(T, Decl(conditionalTypes1.ts, 235, 13))
900+
901+ type T2 = T extends string ? boolean : number;
902+ >T2 : Symbol(T2, Decl(conditionalTypes1.ts, 236, 50))
903+ >T : Symbol(T, Decl(conditionalTypes1.ts, 235, 13))
904+
905+ var x: T1;
906+ >x : Symbol(x, Decl(conditionalTypes1.ts, 238, 7), Decl(conditionalTypes1.ts, 239, 7))
907+ >T1 : Symbol(T1, Decl(conditionalTypes1.ts, 235, 19))
908+
909+ var x: T2;
910+ >x : Symbol(x, Decl(conditionalTypes1.ts, 238, 7), Decl(conditionalTypes1.ts, 239, 7))
911+ >T2 : Symbol(T2, Decl(conditionalTypes1.ts, 236, 50))
912+ }
913+
914+ function f32<T, U>() {
915+ >f32 : Symbol(f32, Decl(conditionalTypes1.ts, 240, 1))
916+ >T : Symbol(T, Decl(conditionalTypes1.ts, 242, 13))
917+ >U : Symbol(U, Decl(conditionalTypes1.ts, 242, 15))
918+
919+ type T1 = T & U extends string ? boolean : number;
920+ >T1 : Symbol(T1, Decl(conditionalTypes1.ts, 242, 22))
921+ >T : Symbol(T, Decl(conditionalTypes1.ts, 242, 13))
922+ >U : Symbol(U, Decl(conditionalTypes1.ts, 242, 15))
923+
924+ type T2 = Foo<T & U>;
925+ >T2 : Symbol(T2, Decl(conditionalTypes1.ts, 243, 54))
926+ >Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 224, 29))
927+ >T : Symbol(T, Decl(conditionalTypes1.ts, 242, 13))
928+ >U : Symbol(U, Decl(conditionalTypes1.ts, 242, 15))
929+
930+ var z: T1;
931+ >z : Symbol(z, Decl(conditionalTypes1.ts, 245, 7), Decl(conditionalTypes1.ts, 246, 7))
932+ >T1 : Symbol(T1, Decl(conditionalTypes1.ts, 242, 22))
933+
934+ var z: T2; // Error, T2 is distributive, T1 isn't
935+ >z : Symbol(z, Decl(conditionalTypes1.ts, 245, 7), Decl(conditionalTypes1.ts, 246, 7))
936+ >T2 : Symbol(T2, Decl(conditionalTypes1.ts, 243, 54))
937+ }
938+
939+ function f33<T, U>() {
940+ >f33 : Symbol(f33, Decl(conditionalTypes1.ts, 247, 1))
941+ >T : Symbol(T, Decl(conditionalTypes1.ts, 249, 13))
942+ >U : Symbol(U, Decl(conditionalTypes1.ts, 249, 15))
943+
944+ type T1 = Foo<T & U>;
945+ >T1 : Symbol(T1, Decl(conditionalTypes1.ts, 249, 22))
946+ >Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 224, 29))
947+ >T : Symbol(T, Decl(conditionalTypes1.ts, 249, 13))
948+ >U : Symbol(U, Decl(conditionalTypes1.ts, 249, 15))
949+
950+ type T2 = Bar<T & U>;
951+ >T2 : Symbol(T2, Decl(conditionalTypes1.ts, 250, 25))
952+ >Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 228, 50))
953+ >T : Symbol(T, Decl(conditionalTypes1.ts, 249, 13))
954+ >U : Symbol(U, Decl(conditionalTypes1.ts, 249, 15))
955+
956+ var z: T1;
957+ >z : Symbol(z, Decl(conditionalTypes1.ts, 252, 7), Decl(conditionalTypes1.ts, 253, 7))
958+ >T1 : Symbol(T1, Decl(conditionalTypes1.ts, 249, 22))
959+
960+ var z: T2;
961+ >z : Symbol(z, Decl(conditionalTypes1.ts, 252, 7), Decl(conditionalTypes1.ts, 253, 7))
962+ >T2 : Symbol(T2, Decl(conditionalTypes1.ts, 250, 25))
963+ }
964+
0 commit comments