@@ -15,3 +15,29 @@ expectType<StringSlice<'abcde', 100, 1>>('');
1515expectType < StringSlice < string > > ( null ! as string ) ;
1616expectType < StringSlice < string , 1 > > ( null ! as string ) ;
1717expectType < StringSlice < string , 1 , 2 > > ( null ! as string ) ;
18+
19+ // Unions
20+ // String is union
21+ expectType < StringSlice < 'abcd' | '0123456789' > > ( { } as 'abcd' | '0123456789' ) ;
22+ expectType < StringSlice < 'abcd' | '0123456789' , 0 , 2 > > ( { } as 'ab' | '01' ) ;
23+
24+ // Start is union
25+ expectType < StringSlice < 'abcd' , 1 | 3 > > ( { } as 'bcd' | 'd' ) ;
26+ expectType < StringSlice < 'abcd' , 0 | 2 , 3 > > ( { } as 'abc' | 'c' ) ;
27+
28+ // End is union
29+ expectType < StringSlice < 'abcd' , 1 , 2 | 3 > > ( { } as 'b' | 'bc' ) ;
30+
31+ // String and start are unions
32+ expectType < StringSlice < 'abcd' | '0123456789' , 1 | 2 > > ( { } as 'bcd' | 'cd' | '123456789' | '23456789' ) ;
33+
34+ // String and end are unions
35+ expectType < StringSlice < 'abcd' | '0123456789' , 1 , 2 | 3 > > ( { } as 'b' | 'bc' | '1' | '12' ) ;
36+
37+ // Start and end are unions
38+ expectType < StringSlice < 'abcd' , 0 | 1 , 2 | 3 > > ( { } as 'ab' | 'abc' | 'b' | 'bc' ) ;
39+
40+ // String, start and end are unions
41+ expectType < StringSlice < 'abcd' | '0123456789' , 0 | 1 , 2 | 3 > > (
42+ { } as 'ab' | 'abc' | 'b' | 'bc' | '01' | '012' | '1' | '12' ,
43+ ) ;
0 commit comments