@@ -46,13 +46,14 @@ export function offsetForArgs(options: ResolveOffsetConnectionOptions) {
4646export async function resolveOffsetConnection <
4747 T ,
4848 U extends Promise < readonly T [ ] | null > | readonly T [ ] | null ,
49+ I ,
4950> (
5051 options : ResolveOffsetConnectionOptions ,
5152 resolve : ( params : {
5253 offset : number
5354 limit : number
5455 } ) => U & ( MaybePromise < readonly T [ ] | null > | null ) ,
55- ) : Promise < Connection < T > > {
56+ ) : Promise < Connection < T , I > > {
5657 const { limit, offset, expectedSize, hasPreviousPage, hasNextPage } = offsetForArgs ( options )
5758
5859 const nodes = ( await resolve ( { offset, limit } ) ) as T [ ] | null
@@ -90,10 +91,10 @@ export function offsetToCursor(offset: number): string {
9091 return Buffer . from ( `${ OFFSET_CURSOR_PREFIX } ${ offset } ` ) . toString ( 'base64' )
9192}
9293
93- export function resolveArrayConnection < T > (
94+ export function resolveArrayConnection < T , I > (
9495 options : ResolveArrayConnectionOptions ,
9596 array : readonly T [ ] ,
96- ) : Connection < T > {
97+ ) : Connection < T , I > {
9798 const { limit, offset, expectedSize, hasPreviousPage, hasNextPage } = offsetForArgs ( options )
9899
99100 const nodes = array . slice ( offset , offset + limit )
@@ -149,10 +150,11 @@ type NodeType<T> = T extends Promise<(infer N)[] | null> | (infer N)[] | null ?
149150
150151export async function resolveCursorConnection <
151152 U extends Promise < readonly unknown [ ] | null > | readonly unknown [ ] | null ,
153+ I ,
152154> (
153155 options : ResolveCursorConnectionOptions < NodeType < U > > ,
154156 resolve : ( params : ResolveCursorConnectionArgs ) => U ,
155- ) : Promise < Connection < NodeType < U > > > {
157+ ) : Promise < Connection < NodeType < U > , I > > {
156158 const { before, after, limit, inverted, expectedSize, hasPreviousPage, hasNextPage }
157159 = parseCurserArgs ( options )
158160
0 commit comments