ts-data-forge
    Preparing search index...

    Function castDeepMutable

    • Casts a readonly type T to its DeepMutable<T> equivalent, recursively removing all readonly modifiers.

      ⚠️ Safety Warning: This recursively bypasses ALL immutability guarantees in nested structures. Extremely dangerous for complex data structures as it allows mutation at any depth. The runtime value is unchanged - only TypeScript's type checking is affected.

      Type Parameters

      • T

        The type of the deeply readonly value

      Parameters

      • readonlyValue: T

        The deeply readonly value to cast to deeply mutable

      Returns DeepMutable<T>

      The same value with all readonly modifiers recursively removed from its type

      • castMutable - For shallow mutability casting
      • castDeepReadonly - For the opposite operation
      • structuredClone - Recommended for creating safe copies before mutation