type ExpectedType = Array<{ name: number, gender?: string }>
function go1(p: ExpectedType) {
}
function f() {
const a = [{name: 1, age: 2}]
go1(a) // doesn't complain
go1([{name: 1, age: 2}]) // complain 'Object literal may only specify known...'
go1(['no matter'].map(n => ({name: 1, age: 2}))) // doesn't complain
}
The typescript code is as above, my question is that isn't the last three lines the same? Why the first line can pass and the second line get a complaint, and the third line get a pass?
Also on the typescript playground: playground