Let's say I have this array
const testData = [
{ properties: { number: 1, name: 'haha' } , second: 'this type'},
['one', 'two', 'three'],
];
I want to get the value of 'second' which is 'this type' like this:
const wantToGet = testData[0].second;
But the typescript generates an error saying
Property 'second' does not exist on type 'string[] | { properties: { number: number; name: string; }; second: string; }'.
Property 'second' does not exist on type 'string[]'
testData[0] is always an object, not an array. Why is that?