{ -readonly [K in keyof T]: T[K] }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 }utility typesSimplify
Source effect/Struct.ts:771 lines
export type type Mutable<T> = {
-readonly [K in keyof T]: T[K]
}
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 }
Mutable<function (type parameter) T in type Mutable<T>T> = { -readonly [function (type parameter) KK in keyof function (type parameter) T in type Mutable<T>T]: function (type parameter) T in type Mutable<T>T[function (type parameter) KK] } & {}Referenced by 1 symbols