Prismic Client 7 and Content Relationship

We used to generate prismic types definition with prismic-ts-codegen.
Upgrading prismic client to 7.0.1, and generating new type definition raise this error :

Type error: Namespace '"/xxxx/node_modules/@prismicio/client/dist/index"' has no exported member 'RelationField'.

The types definition created by the slicemachine (1.1.0) also generate this type :
link: prismic.RelationField<"XXXXXXX">;

Did we miss something in the migration guide ?
We have this error for both of our Content Relationship fields.


1 Like

Hello @jeanbaptiste.cazaux

Thanks for reaching out to us.

Can you try to change it manually?

I understand that it should not be the solution to change it manually but try it at this moment in time. I'll check the issue with my dedicated team member and will come back to you.


Yeah it s working.
But since we re generating this file before each build, we ll wait for a release to fix this. Good to know that you re aware of this.

Thank you

Hello @Priyanka
I get the same problem in my side too.
Recommanded solution don't work for us.
We use Content relation Type between Slices and Custom Type.
For this uses case when we delete these lines : prismic.ContentRelationshipField<"XXXXXXX">
Our Code don't work.
We need generated values as params for client.getByUID(****)
Hope there is a quick fix soon.

Thank you

Hello @jeanbaptiste.cazaux @ali

I discussed this with the team and received an update. An updated version of prismic-ts-codegen has been released, which should fix the issue. RelationField should now be generated as ContentRelationshipField.You can update to the latest version using the following command:

npm update prismic-ts-codegen

You will then need to regenerate their types. Using Slice Machine with @slicemachine/adapter-next, you can regenerate types by editing a Slice. We don't have a streamlined way of regenerating types on-demand, so you will need to add a field to a Slice, save it, remove the field, then save it again.

I hope it works, and let me know if you have any further questions.


1 Like

It works perfectly with the new prismic-ts-codegen, thanks !

Great work.
Thank you

1 Like