How do I typing Document with fetchLinks?

Hey @miyazato @Fares I ran into this problem and I solved it.

For context, I am also using prismic-ts-codegen and a GraphQuery.

I looked at the isFilled.contentRelationship and noticed it accepted some generic type arguments, and this is working for me:

// contentRelationship: <TypeEnum, LangEnum, DataInterface>
if (isFilled.contentRelationship<'blog-author', string, BlogAuthorDocument['data']>(doc.data.authorLink)) {
  doc.data.authorLink.data?.avatar;
}
3 Likes