/** Options accepted by [`paginate`]. */ export type PaginateOptions = { /** Items per page. Must be a positive integer (>= 1). */ pageSize: number; /** Name of the dynamic param to fill (e.g. `"page"` for `[page].tsx`). */ param: K; }; /** One page of paginated results. The shape consumed by the page component. */ export type PaginatedPage = { /** Items belonging to this page. */ data: T[]; /** 1-based page number. */ page: number; /** Total number of pages (>= 1). */ lastPage: number; /** Items per page (echoed for convenience). */ pageSize: number; /** Total item count across all pages. */ total: number; }; /** * Route entry returned by [`paginate`], one per page. * * The `K` generic carries the literal param name through, so consumers * accessing e.g. `route.params.page` get `string` rather than * `string | undefined` under `noUncheckedIndexedAccess`. */ export type PaginateRoute = { params: Record; props: { page: PaginatedPage; }; }; /** * Slice `items` into pages of `opts.pageSize` and produce one route entry * per page. The `param` option names the dynamic segment to fill — for * `pages/blog/page/[page].tsx` pass `param: "page"`. * * Always emits at least one route. An empty input list yields a single * empty page so the index route still renders rather than 404ing. */ export declare function paginate(items: readonly T[], opts: PaginateOptions): PaginateRoute[];