Below is a small example I've created to illustrate my problem:
interface testType {
id: number
}
let t: testType[] = [{
id: 1
}]
t = t.map(item => ({
...item,
id: '123'
}))
Imagine that the testType
interface is sourced externally and cannot be modified. I need to append a new array of objects where the id
field is not of type number
. I want to achieve this without creating a new variable, but by utilizing the existing variable t
.