'How change object property value typescript?
interface State {
customerId: number,
step: string
}
const data: State = {
step: 'shipping',
customerId: 123
}
const setData = (key: string, value: number) => {
data[key] = value
}
setData('customerId', 555)
Im try change value of customerId but got error: No index signature with a parameter of type 'string' was found on type 'State'.
How i can set new value?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
