Type alias MutableKeys<T>

MutableKeys<T>: {
    [P in Keys<T>]: Equals<Pick<T, P>, Readonly<Pick<T, P>>> extends true
        ? never
        : P
}[Keys<T>]

Retrieves the keys that are mutable from an object of type T.

Type Parameters

  • T

Example

 type ExampleType = {
a: number;
readonly b: string;
c: {
a: string;
d: { readonly x: Nullable; v: Maybe<Newable> };
};
};

type MutableKeysOfExampleType = MutableKeys<ExampleType>;
// Result: 'a' | 'c'