@@ -126,6 +126,13 @@ describe('PickKeys', () => {
126126 type ResponseModel = { key1 : string }
127127 expectTypeOf < PickKeys < ResponseModel , { } > > ( ) . toEqualTypeOf < ResponseModel > ( )
128128 } )
129+ it ( 'handles arrays' , ( ) => {
130+ type DataModel = { key1 : string ; key2 : string }
131+ type ResponseModel = DataModel [ ]
132+ expectTypeOf < PickKeys < ResponseModel , { key1 : true } > > ( ) . toEqualTypeOf <
133+ { key1 : string } [ ]
134+ > ( )
135+ } )
129136 } )
130137 describe ( 'based on FetchKeys array' , ( ) => {
131138 it ( 'picks keys from object' , ( ) => {
@@ -158,6 +165,13 @@ describe('PickKeys', () => {
158165 PickKeys < ResponseModel , never [ ] >
159166 > ( ) . toEqualTypeOf < ResponseModel > ( )
160167 } )
168+ it ( 'handles arrays' , ( ) => {
169+ type DataModel = { key1 : string ; key2 : string }
170+ type ResponseModel = DataModel [ ]
171+ expectTypeOf < PickKeys < ResponseModel , [ 'key1' ] > > ( ) . toEqualTypeOf <
172+ { key1 : string } [ ]
173+ > ( )
174+ } )
161175 } )
162176} )
163177
@@ -199,6 +213,12 @@ describe('FetchKeys', () => {
199213 | 'key1' [ ]
200214 > ( )
201215 } )
216+ it ( 'handles arrays' , ( ) => {
217+ type MyFetchKeys = FetchKeys < { key1 : string } [ ] >
218+ expectTypeOf < MyFetchKeys > ( ) . toEqualTypeOf <
219+ { key1 ?: true | undefined } | 'key1' [ ]
220+ > ( )
221+ } )
202222} )
203223
204224const clone = < T extends object > ( object : T ) =>
0 commit comments