Consider this scenario:
type Example = {
x: string,
y: number
}
const a: Example = {
x: "x",
y: 1
}
const b: Example = {
x: "y",
y: 2
}
const issue = (keys: (keyof Example)[]) => {
keys.forEach(key => {
a[key] = b[key]
})
}
An error with code TS2322 has been encountered and it's proving difficult to troubleshoot. (or to explain in more detail).
Here is the complete error message:
Type 'string | number' is not assignable to type 'never'.