Implement the advanced util type MutableKeys<T>, which picks all the mutable (not readonly) keys into a union.
MutableKeys<T>
For example:
type Keys = MutableKeys<{ readonly foo: string; bar: number }>; // expected to be “bar”