withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.65k stars 2.48k forks source link

Inaccurate JSdoc comment for `page.size` in astro/@types #11560

Closed ArmandPhilippot closed 3 months ago

ArmandPhilippot commented 3 months ago

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:

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

https://stackblitz.com/edit/astro-paginate-pagesize?file=src%2Fpages%2Fpokemon%2F[page].astro&on=stackblitz

Participation

bluwy commented 3 months ago

You're right. Feel free to send a PR to fix that 👍

ArmandPhilippot commented 3 months ago

@bluwy Done! I just created the issue to keep a track (I don't know if this was needed...).

bluwy commented 3 months ago

For single line changes it may be easier (especially for you as there's less work) to create a PR directly in the future, as long as the PR explains the context too! But still it doesn't hurt if you prefer to open an issue first.

ArmandPhilippot commented 3 months ago

Ok @bluwy, thanks for you feedback! 😄