Was able to find a few examples, notably from this thread:
Still failing to find a solution for actually having a correctly typed getStaticPaths usage, not sure if I'm setting this up correctly:
// pages/blog/[...page].astro
import type { GetStaticPaths, GetStaticPathsResult } from "astro";
import { getCollection } from "astro:content";
export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
const posts = (await getCollection("blog")).sort(
(a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf()
);
return paginate(posts, { pageSize: 5 });
};
const { page } = Astro.props;
^ In this version, page is typed as 'any'. Am I suppose to define the props as something specific? I can see that there are Page types in the astro.d.ts file but I'm not sure how they're intended to be used.
Edit: looks like I can add props to make this work. This seems to be working decently.
type Props = { page: Page<CollectionEntry<"blog">> };