Uid type not being generated by slicemachine

It happens that when creating a Custom Type, the UID field is not automatically generated by Typescript, so if i create a Custom Type with 4 fields, let's say id (uid), title, subtitle and content, i will automatically get the types for the title, subtitle and content but not for the uid. Is there a reason for this behavior?

Thanks!

Hello @emiliano.bucci, you need to add a UID field to a Custom Type manually.
Can you tell us more about your use case?

Hi, and thanks for your answer!

I've created a Custom Type and i've added the UID field; the uid field is available in the api response but the type is not automatically generated by typescript.

You mean that i have to add the UID type manually?

If it is the case for any other content field, I'd say, yes, it's necessary that you define it for the UID field as well.

Ok thanks!

Should i do it like in the example here -> Use TypeScript with Next.js - Documentation - Prismic ?

Yes, that's the official guide for using Prismic with TypeScript and Next.

1 Like