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: ["authors.name", "authors.link"],
})
This is working great and along with the posts data object, I am also getting a nested author.data 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 author.data 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