Creates an immutable deep clone.
Values are processed according to their type:
Date, Map, Set, class
instances, or objects with null prototype)This function is idempotent: calling it multiple times on the same value returns the same reference after the first call, making it safe and efficient to use defensively.
Circular references are not supported. Do not pass objects with cycles.
The type of the value to be cloned
The value to make immutable
A deeply frozen clone of value
Creates an immutable deep clone, validating against a type guard.
Values are processed according to their type:
Date, Map, Set, class
instances, or objects with null prototype)Validates value against the guard before freezing:
Circular references are not supported. Do not pass objects with cycles.
Guards must have stable identity. Use module-level named functions or const lambdas.
The validated type of the returned clone
A deeply frozen clone of value, branded with the guard
Creates an immutable deep clone, optionally validating against a type guard.