File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,23 @@ type GetResultsType<T> = T extends { data: any[] }
5454 ? T [ "data" ] [ KnownKeysMatching < T [ "data" ] , any [ ] > ]
5555 : never ;
5656
57- // Ensure that the type always returns the paginated results and not a mix of paginated results and the response object
58- type NormalizeResponse < T > = Omit < T , "data" > & { data : GetResultsType < T > } ;
57+ // Extract the pagination keys from the response object in order to return them alongside the paginated results
58+ type GetPaginationKeys < T > = T extends { data : any [ ] }
59+ ? T
60+ : T extends { data : object }
61+ ? Pick <
62+ T [ "data" ] ,
63+ Extract <
64+ keyof T [ "data" ] ,
65+ "repository_selection" | "total_count" | "incomplete_results"
66+ >
67+ >
68+ : never ;
5969
70+ // Ensure that the type always returns the paginated results and not a mix of paginated results and the response object
71+ type NormalizeResponse < T > = Omit < T , "data" > & {
72+ data : GetResultsType < T > & GetPaginationKeys < T > ;
73+ } ;
6074type DataType < T > = "data" extends keyof T ? T [ "data" ] : unknown ;
6175
6276export interface MapFunction <
You can’t perform that action at this time.
0 commit comments