I am currently working on writing a specific type of Pagination:
type Pagination<I extends Iterable> = Readonly<{
seek: number;
limit: number;
total: number;
items: I;
}>;
This allows users to utilize:
Pagination<Map<number, any>>
However, there seems to be an issue because Iterable
also requires a generic parameter.
Therefore, I am now using:
type Pagination<I> = Readonly<{
seek: number;
limit: number;
total: number;
items: Iterable<I>;
}
While this solution works, the type signatures are limited to Pagination<number>
without further constraints on the type of iterable to be used.