Setting up Types for Slices


I have deployed my portfolio using Primisic and Next.Js and most of the site is in TS. However, I was unable to get the slices to be types because I can't find the information in the docs.

All I can find is this one example file on Github.

Has anyone found another source or article that was helpful?

Thanks in Advance

Hello @andy2, thanks for reaching out!

We don't yet have specific documentation for TypeScript. @prismicio/types are the source of types for Prismic data. Slices need to be typed with it. For the moment, we have the docs for the manual CLI here: GitHub - prismicio/prismic-ts-codegen: An experimental Prismic model-to-TypeScript-type generator..

thanks @Pau , I'm still new to Typescript so maybe I wait until the official docs come out for slices.

1 Like