I have a type that looks like this:
export type GetTeamsQuery = {
__typename?: 'Query'
Teams?: {
__typename?: 'Teams'
docs?: Array<{
__typename?: 'Team'
email: any
fullName: string
id?: string | null
order: number
phone: string
role: string
county?: Array<{ __typename?: 'County'; id?: string | null; name: string } | null> | null
image?: {
__typename?: 'Media'
alt?: string | null
caption?: string | null
url?: string | null
id?: string | null
} | null
link?: Array<{
__typename?: 'Team_Links'
id?: string | null
username?: string | null
social?: { __typename?: 'Social'; id?: string | null; name: string; url: string } | null
} | null> | null
} | null> | null
} | null
}
I'm able to access the first nested prop by: GetTeamsQuery[Teams], but I can't do GetTeamsQuery[Teams].docs? How can I access docs?
I tried this as well:
type Teams = GetTeamsQuery['Teams']
type Docs = Teams['docs']
TS error:
Property 'docs' does not exist on type '{ __typename?: "Teams" | undefined; docs?: ({ __typename?: "Team" | undefined; email: any; fullName: string; id?: string | null | undefined; order: number; phone: string; role: string; county?: ({ ...; } | null)[] | ... 1 more ... | undefined; image?: { ...; } | ... 1 more ... | undefined; link?: ({ ...; } | null)[]...'.ts(2339)