Skip to content

Commit fe0fbea

Browse files
committed
add an example
1 parent 597980f commit fe0fbea

File tree

1 file changed

+7
-3
lines changed
  • packages/astro/test/fixtures/astro-get-static-paths/src/pages/posts

1 file changed

+7
-3
lines changed

packages/astro/test/fixtures/astro-get-static-paths/src/pages/posts/[page].astro

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
2-
export async function getStaticPaths() {
2+
import type { GetStaticPaths, InferGetStaticParamsType } from "astro";
3+
4+
export const getStaticPaths = (() => {
35
return [
46
{
57
params: { page: 1 },
@@ -11,9 +13,11 @@ export async function getStaticPaths() {
1113
params: { page: 3 }
1214
}
1315
]
14-
};
16+
}) satisfies GetStaticPaths;
1517
16-
const { page } = Astro.params
18+
type Params = InferGetStaticParamsType<typeof getStaticPaths>;
19+
const params = Astro.params as Params;
20+
const page = params.page satisfies string
1721
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
1822
---
1923

0 commit comments

Comments
 (0)