I have a class constructor and I want populate it with an object that I receive in constructor. But I don't know how to solve this TS error on line this[key] = object[key]
Code
constructor(object: any) { if (object) { for (const key in object) { if (object.hasOwnProperty(key)) { this[key] = object[key]; } } } }