Mutable
Transforms a type by removing readonly
modifiers, allowing mutation of properties.
import type { Mutable } from '@fullstacksjs/toolbox';
Signature
type Mutable<T> = {
-readonly [P in keyof T]: T[P];
};
Example
type Sample = { readonly a: number };
const obj: Mutable<Sample> = { a: 5 };
obj.a = 10; // allowed