I've assigning to a partial in the constructor works really well, however it can write extra properties (if the object we pass into the data has a property which class T does not, it still gets copied)
id: number
username: string
....
constructor(data: Partial<T>)
{
Object.assign(this, data)
}
How can I avoid this?
Object.keys(this)
is empty when called in the constructor, so I cannot properly compare keys.