Is there a way to properly type a "generic query"

Is there a way to properly type a "generic query" with drizzle, rather than trying to duck-type it like this

export async function paginateWithCursor<
  T,
  TQuery extends {
    where: (condition: SQL) => TQuery;
    orderBy: (...fields: SQL[]) => TQuery;
    limit: (limit: number) => TQuery;
  } & Promise<T[]>,
>(
  baseQuery: TQuery,
  cursorConfig: CursorConfig,
  options?: CursorPaginationOptions,
): Promise<CursorPaginationResult<T>> {
Was this page helpful?