I'm practicing TS and I want to pass an array of strings (each string has the property name pair in the form "name=property") to an object, and it works but it shows me an error if I want to print a single property:
var array = ["nombre=jorge","apellido=balsamo","dni=45869202"]
var obj = new Object();
array.forEach(index => {
Object.defineProperty(obj,index.split("=")[0],{ value: `${index.split("=")[1]}`, writable: true})
})
console.log(obj.nombre)
"Property 'name' does not exist on type 'Object'." that error throws me, but in JS this works fine, I guess it's because of the strong typing but I don't know how to solve this, I could add something like an interface so that it recognizes that the object contains these properties but if the array were bigger and had More properties than just 3 I don't know how to implement it.