@@ -16,16 +16,23 @@ type Example = {
1616 literal : 'foo' ;
1717 string : string ;
1818 map : Map < string , string > ;
19+ readonlyMap : ReadonlyMap < string , string > ;
20+ weakMap : WeakMap < WeakKey , string > ;
1921 set : Set < string > ;
22+ readonlySet : ReadonlySet < string > ;
23+ weakSet : WeakSet < WeakKey > ;
2024 date : Date ;
2125 number : 1 ;
2226 array : string [ ] ;
27+ readonlyArray : readonly string [ ] ;
2328 tuples : [ 'foo' , 'bar' ] ;
2429 interface : InterfaceA ;
2530 instanceA : ClassA ;
2631 ClassA : typeof ClassA ;
2732 function : ( ...arguments_ : string [ ] ) => string ;
33+ promise : Promise < string > ;
2834 stringOrBoolean : string | boolean ;
35+ never : never ;
2936 object : {
3037 string : string ;
3138 subObject : {
@@ -42,6 +49,7 @@ expectType<{
4249 instanceA : {
4350 a : string ;
4451 } ;
52+ never : never ;
4553 object : {
4654 string : string ;
4755 subObject : {
@@ -71,6 +79,7 @@ expectType<{
7179 instanceA : {
7280 a : string ;
7381 } ;
82+ never : never ;
7483 object : {
7584 string : string ;
7685 subObject : {
@@ -84,13 +93,16 @@ declare const stringPickOptionalOnly: ConditionalPickDeep<Example, string | unde
8493expectType < { object : { subObject : { optional ?: string } } } > ( stringPickOptionalOnly ) ;
8594
8695declare const booleanPick : ConditionalPickDeep < Example , boolean | undefined > ;
87- expectType < { optional ?: boolean ; optionalWithUndefined ?: boolean | undefined } > ( booleanPick ) ;
96+ expectType < { optional ?: boolean ; optionalWithUndefined ?: boolean | undefined ; never : never } > ( booleanPick ) ;
8897
8998declare const numberPick : ConditionalPickDeep < Example , number > ;
90- expectType < { number : 1 ; interface : { a : number } } > ( numberPick ) ;
99+ expectType < { number : 1 ; interface : { a : number } ; never : never } > ( numberPick ) ;
91100
92101declare const emptyPick : ConditionalPickDeep < Example , 'abcdefg' > ;
93- expectType < { } > ( emptyPick ) ;
102+ expectType < { never : never } > ( emptyPick ) ;
103+
104+ declare const emptyEqualityPick : ConditionalPickDeep < Example , 'abcdefg' , { condition : 'equality' } > ;
105+ expectType < { } > ( emptyEqualityPick ) ;
94106
95107declare const stringOrBooleanPick : ConditionalPickDeep < Example , string | boolean > ;
96108expectType < {
@@ -100,6 +112,7 @@ expectType<{
100112 instanceA : {
101113 a : string ;
102114 } ;
115+ never : never ;
103116 object : {
104117 string : string ;
105118 subObject : {
@@ -112,28 +125,28 @@ declare const stringOrBooleanPickOnly: ConditionalPickDeep<Example, string | boo
112125expectType < { stringOrBoolean : string | boolean } > ( stringOrBooleanPickOnly ) ;
113126
114127declare const arrayPick : ConditionalPickDeep < Example , string [ ] > ;
115- expectType < { array : string [ ] ; tuples : [ 'foo' , 'bar' ] } > ( arrayPick ) ;
128+ expectType < { array : string [ ] ; tuples : [ 'foo' , 'bar' ] ; never : never } > ( arrayPick ) ;
116129
117130declare const arrayEqualityPick : ConditionalPickDeep < Example , string [ ] , { condition : 'equality' } > ;
118131expectType < { array : string [ ] } > ( arrayEqualityPick ) ;
119132
120133declare const tuplePick : ConditionalPickDeep < Example , [ 'foo' , 'bar' ] > ;
121- expectType < { tuples : [ 'foo' , 'bar' ] } > ( tuplePick ) ;
134+ expectType < { tuples : [ 'foo' , 'bar' ] ; never : never } > ( tuplePick ) ;
122135
123136declare const instancePick : ConditionalPickDeep < Example , ClassA > ;
124- expectType < { instanceA : ClassA } > ( instancePick ) ;
137+ expectType < { instanceA : ClassA ; never : never } > ( instancePick ) ;
125138
126139declare const classPick : ConditionalPickDeep < Example , typeof ClassA > ;
127- expectType < { ClassA : typeof ClassA } > ( classPick ) ;
140+ expectType < { ClassA : typeof ClassA ; never : never } > ( classPick ) ;
128141
129142declare const functionPick : ConditionalPickDeep < Example , ( ...arguments_ : string [ ] ) => string > ;
130- expectType < { function : ( ...arguments_ : string [ ] ) => string } > ( functionPick ) ;
143+ expectType < { function : ( ...arguments_ : string [ ] ) => string ; never : never } > ( functionPick ) ;
131144
132145declare const mapPick : ConditionalPickDeep < Example , Map < string , string > > ;
133- expectType < { map : Map < string , string > } > ( mapPick ) ;
146+ expectType < { map : Map < string , string > ; never : never } > ( mapPick ) ;
134147
135148declare const setPick : ConditionalPickDeep < Example , Set < string > > ;
136- expectType < { set : Set < string > } > ( setPick ) ;
149+ expectType < { set : Set < string > ; never : never } > ( setPick ) ;
137150
138151declare const interfaceTest : ConditionalPickDeep < Example , InterfaceA > ;
139- expectType < { interface : InterfaceA } > ( interfaceTest ) ;
152+ expectType < { interface : InterfaceA ; never : never } > ( interfaceTest ) ;
0 commit comments