Types for relationship in a Slice

How can i fix this:

Property 'uid' does not exist on type 'ContentRelationshipField<"social_media">'.
Property 'uid' does not exist on type 'EmptyLinkField<"Document">'.ts(2339)

Thank you!

Can I encourage you to see this thread? I believe it's related:
Types for content relationship in a Slice - Developing with Prismic - Prismic People

nf_mastroianniNeil Thank you for the link,

Tried it but i'm new to TS, hard to know how to do it correctly, can you please help?

Hi, you have to declare socialMediaUID in condition:

if (isFilled.contentRelationship(slice.primary.social_media)) {
  socialMediaUID = slice.primary.social_media.uid

The UID exist if the field is not empty.

1 Like

Thank you very much !!