function withPaginationAndCount<T extends PgSelect>(
qb: T,
page: number = 1,
pageSize: number = 10,
): {count: number, result: any} {
// how to rewrite like this?
const count = qb.select({count: count()})...;
count paginationResult = qb.limit(pageSize).offset((page - 1) * pageSize);
return Promise.all([count, paginationResult]);
}
function withPaginationAndCount<T extends PgSelect>(
qb: T,
page: number = 1,
pageSize: number = 10,
): {count: number, result: any} {
// how to rewrite like this?
const count = qb.select({count: count()})...;
count paginationResult = qb.limit(pageSize).offset((page - 1) * pageSize);
return Promise.all([count, paginationResult]);
}