I want to be able to make readonly properties (not getters) for users of my class, but I need to update them internally; is there a way to do this and allow to
readonly
My current solution for TypeScript 3.6.3
type Mutable = { -readonly [k in keyof T]: T[k]; }; class Item { readonly id: string; changeId(newId: string) { const mutableThis = this as Mutable; mutableThis.id = newId; } }