Trying to create a matching GQL type for this Typescript interface:
interface List {
items: [String] | [[String]]
}
Initially, I attempted to keep it straightforward:
type List {
items: [String]! | [[String]!]!
}
However, GQL did not approve of that approach. So, I decided to try something different:
type List1D {
items: [String]!
}
type List2D {
items: [[String]!]!
}
union ListItems = List1D | List2D
type List {
items: ListItems
}
My concern is that it might lead to a structure like this:
{
items: {
items: [] // union type
}
}
How can I achieve my original goal with this setup?