let ={
"name": "jacob",
"age": 22 }
I want to update it dynamically into { "name": "jacob", "age": 22 , "dob":number }
let ={
"name": "jacob",
"age": 22 }
I want to update it dynamically into { "name": "jacob", "age": 22 , "dob":number }
The first thing is if you are using TS, then you need to define the type for the object with the dob key as optional. Otherwise, TS will keep giving the error and your Angular application will not compile.
The current way you are trying to do has no type defined for the object and TS automatically evaluated the type to {name: string, age: number} and throws an error when you try to add another property.
Note:- It would be great if you go through the basics of Typescript.