Typescript Error with getStaticProps

Hello there,

The follwing code runs but i get a typescript error on params.uid inside getStaticProps using NEXTJS13.

export async function getStaticProps({
  params,
  locale,
  previewData,
}: GetStaticPropsContext) {
  const client = createClient({ previewData });
  const navigation = await client.getByUID("navigation", "header", {
    lang: locale,
  });
  const page = await client.getByUID("page", params.uid, { lang: locale });
  return {
    props: {
      page,
      navigation,
    },
  };
}

I’ve postet the whole page here : [Typescript Erro · GitHub] (https://[uid].tsx on github)

Hello @daniel3

Welcome to the Prismic community, and thanks for reaching out to us.

I believe you need to type params. Here’s what it should look like in order to type params:

type PageParams = {
        uid: string
}

We have a “Next.js: TypeScript” guide covering your questions.
Use TypeScript with Next.js - Documentation - Prismic the use of Next.js’s GetStaticPropsContext.

Give this a try, and let me know.

Thanks,
Priyanka