I want to convert a js object into typescript version (we are refactoring the code) :( But I don't get how to migrate a JS JSON object into a correct TS format. For example, we have a JS object like this:
JS Object:
{
"filter": {
"price": {
"$gte": 10,
"$lte": 100
},
"symbol": "appl"
},
"sort": {
"createdAt": -1
}
}
So it's easy in js code that we declare a params = {}
and we can insert params.filter[price] = ....
.
However, if we want to do it in Typescript, the compiler will complain that we need to determine the type, and it's hard because as you can see the "value" can be string or int or another object.
Do you have any ideas on it? Super thanks!!!!!