I have an object:
const sampleExpenseData = {
Time: "11-12-19",
Meals: 5130,
Pantry: 10,
Living: 10,
Others: 0,
Total: 74
}
I would like to define a function such that it will update the value of a specific key, what I have so far is:
const updateValueInDict = (
obj: typeof sampleExpenseData,
key: keyof typeof sampleExpenseData,
upDatedValue: string | number
): void => {
obj[key] = upDatedValue // this line throws error
}
The error says:
Type 'string | number' is not assignable to type 'never'.
Type 'string' is not assignable to type 'never'.ts(2322)
TIA!!!