DeepMutable<T>Recursively removes readonly from all properties, including nested
objects, arrays, Map, and Set.
When to use
Use when you need a fully mutable version of a deeply readonly type.
Details
Recursion stops at primitives (string, number, boolean, bigint,
symbol) and functions.
Example (Converting deeply to mutable types)
import type { Types } from "effect"
type Deep = Types.DeepMutable<{
readonly a: string
readonly b: ReadonlyArray<{ readonly c: number }>
}>
// { a: string; b: Array<{ c: number }> }export type type DeepMutable<T> =
T extends ReadonlyMap<infer K, infer V>
? Map<DeepMutable<K>, DeepMutable<V>>
: T extends ReadonlySet<infer V>
? Set<DeepMutable<V>>
: T extends
| string
| number
| bigint
| boolean
| symbol
| Function
? T
: {
-readonly [K in keyof T]: DeepMutable<
T[K]
>
}
Recursively removes readonly from all properties, including nested
objects, arrays, Map, and Set.
When to use
Use when you need a fully mutable version of a deeply readonly type.
Details
Recursion stops at primitives (string, number, boolean, bigint,
symbol) and functions.
Example (Converting deeply to mutable types)
import type { Types } from "effect"
type Deep = Types.DeepMutable<{
readonly a: string
readonly b: ReadonlyArray<{ readonly c: number }>
}>
// { a: string; b: Array<{ c: number }> }
DeepMutable<function (type parameter) T in type DeepMutable<T>T> = function (type parameter) T in type DeepMutable<T>T extends interface ReadonlyMap<K, V>ReadonlyMap<infer function (type parameter) KK, infer function (type parameter) VV> ? interface Map<K, V>Map<type DeepMutable<T> =
T extends ReadonlyMap<infer K, infer V>
? Map<DeepMutable<K>, DeepMutable<V>>
: T extends ReadonlySet<infer V>
? Set<DeepMutable<V>>
: T extends
| string
| number
| bigint
| boolean
| symbol
| Function
? T
: {
-readonly [K in keyof T]: DeepMutable<
T[K]
>
}
Recursively removes readonly from all properties, including nested
objects, arrays, Map, and Set.
When to use
Use when you need a fully mutable version of a deeply readonly type.
Details
Recursion stops at primitives (string, number, boolean, bigint,
symbol) and functions.
Example (Converting deeply to mutable types)
import type { Types } from "effect"
type Deep = Types.DeepMutable<{
readonly a: string
readonly b: ReadonlyArray<{ readonly c: number }>
}>
// { a: string; b: Array<{ c: number }> }
DeepMutable<function (type parameter) KK>, type DeepMutable<T> =
T extends ReadonlyMap<infer K, infer V>
? Map<DeepMutable<K>, DeepMutable<V>>
: T extends ReadonlySet<infer V>
? Set<DeepMutable<V>>
: T extends
| string
| number
| bigint
| boolean
| symbol
| Function
? T
: {
-readonly [K in keyof T]: DeepMutable<
T[K]
>
}
Recursively removes readonly from all properties, including nested
objects, arrays, Map, and Set.
When to use
Use when you need a fully mutable version of a deeply readonly type.
Details
Recursion stops at primitives (string, number, boolean, bigint,
symbol) and functions.
Example (Converting deeply to mutable types)
import type { Types } from "effect"
type Deep = Types.DeepMutable<{
readonly a: string
readonly b: ReadonlyArray<{ readonly c: number }>
}>
// { a: string; b: Array<{ c: number }> }
DeepMutable<function (type parameter) VV>>
: function (type parameter) T in type DeepMutable<T>T extends interface ReadonlySet<T>ReadonlySet<infer function (type parameter) VV> ? interface Set<T>Set<type DeepMutable<T> =
T extends ReadonlyMap<infer K, infer V>
? Map<DeepMutable<K>, DeepMutable<V>>
: T extends ReadonlySet<infer V>
? Set<DeepMutable<V>>
: T extends
| string
| number
| bigint
| boolean
| symbol
| Function
? T
: {
-readonly [K in keyof T]: DeepMutable<
T[K]
>
}
Recursively removes readonly from all properties, including nested
objects, arrays, Map, and Set.
When to use
Use when you need a fully mutable version of a deeply readonly type.
Details
Recursion stops at primitives (string, number, boolean, bigint,
symbol) and functions.
Example (Converting deeply to mutable types)
import type { Types } from "effect"
type Deep = Types.DeepMutable<{
readonly a: string
readonly b: ReadonlyArray<{ readonly c: number }>
}>
// { a: string; b: Array<{ c: number }> }
DeepMutable<function (type parameter) VV>>
: function (type parameter) T in type DeepMutable<T>T extends string | number | boolean | bigint | symbol | Function ? function (type parameter) T in type DeepMutable<T>T
: { -readonly [function (type parameter) KK in keyof function (type parameter) T in type DeepMutable<T>T]: type DeepMutable<T> =
T extends ReadonlyMap<infer K, infer V>
? Map<DeepMutable<K>, DeepMutable<V>>
: T extends ReadonlySet<infer V>
? Set<DeepMutable<V>>
: T extends
| string
| number
| bigint
| boolean
| symbol
| Function
? T
: {
-readonly [K in keyof T]: DeepMutable<
T[K]
>
}
Recursively removes readonly from all properties, including nested
objects, arrays, Map, and Set.
When to use
Use when you need a fully mutable version of a deeply readonly type.
Details
Recursion stops at primitives (string, number, boolean, bigint,
symbol) and functions.
Example (Converting deeply to mutable types)
import type { Types } from "effect"
type Deep = Types.DeepMutable<{
readonly a: string
readonly b: ReadonlyArray<{ readonly c: number }>
}>
// { a: string; b: Array<{ c: number }> }
DeepMutable<function (type parameter) T in type DeepMutable<T>T[function (type parameter) KK]> }