export class WordResponseDTO { constructor(partial: Partial) { if (partial.id) this.id = partial.id if (partial.value) this.value = partial.value if (partial.ownerId) this.ownerId = partial.ownerId if (partial.enabled) this.enabled = partial.enabled } id: number; value: string; ownerId: string; enabled: boolean; loading?: boolean = false toJSON() { return { ...this } // here I make a POJO's copy of the class instance } }