effect-io-ai

Package: effect
Module: Types

Types.DeepMutable

Like Types.Mutable, but works recursively.

Example

import type { Types } from "effect"

type DeepMutableStruct = Types.DeepMutable<{
  readonly a: string;
  readonly b: readonly string[]
}>
// { a: string; b: string[] }

Signature

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 | boolean | bigint | symbol | Function ? T
  : { -readonly [K in keyof T]: DeepMutable<T[K]> }

Source

Since v3.1.0