Skip to content
Advertisement

Is there an easy way to change one value in a nested json data with TypeScript?

TypeScript version: ^3.5.3

For this json

JavaScript

It can be changed to a new title with spread syntax as

JavaScript

The final newConfig data will be

JavaScript

But in this case

JavaScript

Also want to change title‘s value. Tried

JavaScript

It will break the pre-defined json schema:

JavaScript

So is there an easy way to overwrite only one item in this kind of json?

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement