-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Inaccurate JSdoc comment for page.size in astro/@types #11560
Copy link
Copy link
Closed
Labels
- P2: nice to haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)
Description
Astro Info
Astro v4.12.2
Node v18.20.3
System Linux (x64)
Package Manager npm
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I was reading the Routing guide and I noticed an error which leads me to astro/@types package.
The Page interface in astro/@types indicates that the default for page.size is 25. It seems to be wrong:
- see paginate.ts#L19 and paginate.ts#L80:
page.sizeuses the givenpageSizeoption inpaginate()function or10. - Stackblitz reproduction (click on
Pokemon - Page 1in the preview)
What's the expected result?
/**
* Represents a single page of data in a paginated collection
*
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#the-pagination-page-prop)
*/
export interface Page<T = any> {
/** result */
data: T[];
/** metadata */
/** the count of the first item on the page, starting from 0 */
start: number;
/** the count of the last item on the page, starting from 0 */
end: number;
/** total number of results */
total: number;
/** the current page number, starting from 1 */
currentPage: number;
- /** number of items per page (default: 25) */
+ /** number of items per page (default: 10) */
size: number;
/** number of last page */
lastPage: number;
url: {
/** url of the current page */
current: string;
/** url of the previous page (if there is one) */
prev: string | undefined;
/** url of the next page (if there is one) */
next: string | undefined;
/** url of the first page (if the current page is not the first page) */
first: string | undefined;
/** url of the next page (if the current page in not the last page) */
last: string | undefined;
};
}Link to Minimal Reproducible Example
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P2: nice to haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)