0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-10 23:01:26 -05:00

Fix:changes the paginate function to allow readonly array types (#13213)

* changes the paginate function to allow readonly array types

* Update paginate function to accept readonly arrays

---------

Co-authored-by: Matt Kane <m@mk.gg>
This commit is contained in:
Josh Kennedy 2025-02-12 06:44:43 -05:00 committed by GitHub
parent 8e5b89c5eb
commit 6bac644241
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Allows readonly arrays to be passed to the `paginate()` function

View file

@ -15,7 +15,7 @@ export function generatePaginateFunction(
base: AstroConfig['base'],
): (...args: Parameters<PaginateFunction>) => ReturnType<PaginateFunction> {
return function paginateUtility(
data: any[],
data: readonly any[],
args: PaginateOptions<Props, Params> = {},
): ReturnType<PaginateFunction> {
let { pageSize: _pageSize, params: _params, props: _props } = args;

View file

@ -82,7 +82,7 @@ export type PaginateFunction = <
AdditionalPaginateProps extends Props,
AdditionalPaginateParams extends Params,
>(
data: PaginateData[],
data: readonly PaginateData[],
args?: PaginateOptions<AdditionalPaginateProps, AdditionalPaginateParams>,
) => {
params: Simplify<