Type Alias: Mutable<T>
Mutable<
T
>: { -readonly [P in keyof T]: T[P] extends unknown[] | object ? Mutable<T[P]> : T[P] }
Transforms a readonly
type to be mutable
Type Parameters
Type Parameter |
---|
T |
Example
interface Sample {
id: string;
hobbies: readonly string[];
}
type BB = Mutable<Sample>;
// Expected:
// {
// id: string;
// hobbies: string[];
// }