11import type { argsKey } from "./request" ;
2- import type { RequireAtLeastOneFieldSet , UnArray } from "./utilTypes" ;
2+ import type { RequireAtLeastOneFieldSet , UnArray , UnFunc } from "./utilTypes" ;
33
44//TODO: Find out how to sanely refactor these types
55
@@ -27,13 +27,19 @@ type QueryableObjectField<T> =
2727 ) => QueryResponse extends null
2828 ? Response <
2929 QueryResponse extends Array < any >
30- ? ApplySelection < NonNullable < UnArray < QueryResponse > > , Selected > [ ]
31- : ApplySelection < NonNullable < UnArray < QueryResponse > > , Selected >
30+ ? ApplySelection <
31+ NonNullable < UnArray < UnFunc < QueryResponse > > > ,
32+ Selected
33+ > [ ]
34+ : ApplySelection <
35+ NonNullable < UnArray < UnFunc < QueryResponse > > > ,
36+ Selected
37+ >
3238 > | null
3339 : Response <
3440 QueryResponse extends Array < any >
35- ? ApplySelection < UnArray < QueryResponse > , Selected > [ ]
36- : ApplySelection < UnArray < QueryResponse > , Selected >
41+ ? ApplySelection < UnArray < UnFunc < QueryResponse > > , Selected > [ ]
42+ : ApplySelection < UnArray < UnFunc < QueryResponse > > , Selected >
3743 >
3844 : // otherwise this is just types as a simple field
3945 Response < T > ;
@@ -54,8 +60,13 @@ export type ApplySelection<Object, Selection> = {
5460 p : infer _P ,
5561 ) => infer _A
5662 ? ReturnType < Object [ Key ] > extends Array < any >
57- ? Array < ApplySelection < UnArray < ReturnType < Object [ Key ] > > , Selection [ Key ] > >
58- : ApplySelection < UnArray < Object [ Key ] > , Selection [ Key ] >
63+ ? Array <
64+ ApplySelection <
65+ UnArray < UnFunc < ReturnType < Object [ Key ] > > > ,
66+ Selection [ Key ]
67+ >
68+ >
69+ : ApplySelection < UnArray < UnFunc < Object [ Key ] > > , Selection [ Key ] >
5970 : Object [ Key ] ;
6071} ;
6172
0 commit comments