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:
parent
8e5b89c5eb
commit
6bac644241
3 changed files with 7 additions and 2 deletions
5
.changeset/thick-crabs-juggle.md
Normal file
5
.changeset/thick-crabs-juggle.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Allows readonly arrays to be passed to the `paginate()` function
|
|
@ -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;
|
||||
|
|
|
@ -82,7 +82,7 @@ export type PaginateFunction = <
|
|||
AdditionalPaginateProps extends Props,
|
||||
AdditionalPaginateParams extends Params,
|
||||
>(
|
||||
data: PaginateData[],
|
||||
data: readonly PaginateData[],
|
||||
args?: PaginateOptions<AdditionalPaginateProps, AdditionalPaginateParams>,
|
||||
) => {
|
||||
params: Simplify<
|
||||
|
|
Loading…
Add table
Reference in a new issue