How does typescript define multiple type arrays? And array item is one of them.
interface A {
m: string,
n: number
}
interface B {
x: boolean
y: number[]
}
type C = A | B
const arr: C[] = [
{m: '1', n: 1, x: true}
]
I want array item is A or B type, only match one of them, like this:
const arr: C[] = [
{m: '1', n: 1}
]
// or
const arr: C[] = [
{x: true, y: [1,2,3]}
]