Why can't typescript do reduce using below code? Here a demo as well.
const temp = [
{
"id": "1",
"stations": [{
id: 'abc'
}],
},
{
"id": "2",
"stations": [{
id: 'def'
}]
}
]
const x = temp.reduce((accum, o) => {
accum.push(o.stations) //what's wrong here?
return accum
}, [])
reduce[]as the starting value.[]is always inferred asnever[].