Hyperlinkv0.8.0-beta.28

Struct

Struct.Mutabletypeeffect/Struct.ts:77
{ -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 Mutable<T> = { -readonly [K in keyof T]: T[K] } & {}
Referenced by 1 symbols