Package: effect
Module: Struct
Removes readonly modifiers from all properties of an object type.
When to use
Use when you need a mutable version of a readonly interface.
Details
This helper is purely cosmetic at the type level and has no runtime effect.
It also flattens intersections like Simplify.
Example (Making a readonly type mutable)
import type { Struct } from "effect"
type ReadOnly = { readonly a: string; readonly b: number }
type Writable = Struct.Mutable<ReadOnly>
// { a: string; b: number }
See
Simplify – flattens intersections without removing readonlySignature
type { -readonly [K in keyof T]: T[K]; } = { -readonly [K in keyof T]: T[K] } & {}
Since v4.0.0