How to type a query with fetchLinks

Hello! I have a blog post with a content relationship field of author in it.

I have so far been able to query the posts like this

const posts = await client.getAllByType("blog_posts", {
    fetchLinks: ["", ""],

This is working great and along with the posts data object, I am also getting a nested object with the name & link fields.

I want to now pass this author into a Post component that I have. I am wondering how I can type the author prop such that it takes into consideration the nested object. Do I have to keep this type up to date manually or is there some Generics magic I can use to type it.

I am not very good with complex typescript.

type PostProps = {
  featured?: boolean
  last_publication_date: string
  uid: KeyTextField
  cover_image: ImageField
  title: KeyTextField
  author: ContentRelationshipField<"authors">
  summary: KeyTextField

This is what I have so far. But it doesn't seem to work

Hi Neesh,

Thanks for posting your question!

I think that Angelo's helper, here, might solve your issue:

Take a look and let me know if that helps.