typescript assign object to variable code example
Example 1: typescript dynamic key value object
interface LooseObject {
[key: string]: any
}
var obj: LooseObject = {};
Example 2: typescript obejct replace propertyies
const recievedKeys = Object.keys(receivedObject) as Array<keyof IEvent>
for (const key of recievedKeys) {
this.event = {
...this.event,
[key]: receivedObject[key]
}
}