How do you type this params in getStaticProps() ?
Unanswered
Chartreux posted this in #help-forum
ChartreuxOP
export async function getStaticProps({ params }) {
const prisma = new PrismaClient();
const slug = params.slug;
const cat = await prisma.cat.findFirst({
where: {
slug,
},
});
if (!cat) {
throw new Error(`Couldnt find cat with slug: ${params.slug}`);
}
const images = JSON.parse(cat.images) as CatImage[];
return {
props: {
cat,
images,
},
};
}How can I type the params correctly? It says this error:
Binding element 'params' implicitly has an 'any' type.