diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 48cac0d12c..d63e1dbf4e 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -777,7 +777,8 @@ export type GetHydrateCallback = () => Promise<() => void | Promise>; /** * getStaticPaths() options - * Docs: https://docs.astro.build/reference/api-reference/#getstaticpaths + * + * [Astro Reference](https://docs.astro.build/en/reference/api-reference/#getstaticpaths) */ export interface GetStaticPathsOptions { paginate: PaginateFunction; /** @@ -793,6 +794,18 @@ export type GetStaticPathsResultKeyed = GetStaticPathsResult & { keyed: Map; }; +/** + * Return an array of pages to generate for a [dynamic route](https://docs.astro.build/en/core-concepts/routing/#dynamic-routes). (**SSG Only**) + * + * [Astro Reference](https://docs.astro.build/en/reference/api-reference/#getstaticpaths) + */ +export type GetStaticPaths = ( + options: GetStaticPathsOptions +) => + | Promise + | GetStaticPathsResult + | GetStaticPathsResult[]; + export interface HydrateOptions { name: string; value?: string; @@ -820,7 +833,8 @@ export interface MarkdownParserResponse extends MarkdownRenderingResult { /** * The `content` prop given to a Layout - * https://docs.astro.build/guides/markdown-content/#markdown-layouts + * + * [Astro reference](https://docs.astro.build/en/guides/markdown-content/#markdown-layouts) */ export type MarkdownContent = Record> = T & { astro: MarkdownMetadata; @@ -828,7 +842,8 @@ export type MarkdownContent = Record> /** * paginate() Options - * Docs: https://docs.astro.build/guides/pagination/#calling-the-paginate-function + * + * [Astro reference](https://docs.astro.build/en/reference/api-reference/#paginate) */ export interface PaginateOptions { /** the number of items per-page (default: `10`) */ @@ -840,8 +855,9 @@ export interface PaginateOptions { } /** - * Page Prop - * Docs: https://docs.astro.build/guides/pagination/#using-the-page-prop + * 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 { /** result */ @@ -869,7 +885,7 @@ export interface Page { }; } -export type PaginateFunction = (data: [], args?: PaginateOptions) => GetStaticPathsResult; +export type PaginateFunction = (data: any[], args?: PaginateOptions) => GetStaticPathsResult; export type Params = Record;