I have a nested Object.assign()in typescript:
(<any>Object).assign({}, state, {
action.item_id: (<any>Object).assign({}, state[action.item_id], {
label_value: action.value
})
})
This gives the following errors:
ERROR in ./src/reducers/ItemsReducer.ts
(2,19): error TS1005: ':' expected.
ERROR in ./src/reducers/ItemsReducer.ts
(2,26): error TS1005: ',' expected.
ERROR in ./src/reducers/ItemsReducer.ts
(2,28): error TS1136: Property assignment expected.
It is strange that the errors disappear if I correct the key, for example:
(<any>Object).assign({}, state, {
"fixed_key": (<any>Object).assign({}, state[action.item_id], {
label_value: action.value
})
})
This left me dumb, why not call action.item_idin a place where he doesn't complain about a few characters after?
source
share