I'm actually not event sure how to phrase the question correctly. From a code generator I get the following interface as an input for an API request:
interface foo {
bar: ('foo' | 'bar')[]
}
To access this I can create aliases like type xy = foo['bar']. But I actually have no idea how to get a type that includes the union inside an array. I want to have a type type union = 'foo' | 'bar' by referencing the interface.
I already tried to use index anotation like type union = foo['bar'][string] or type union = foo['bar'][number] but that throws an error.