Skip to main content

types/Immutable

Type Aliases

Immutable<T>

type Immutable<T>: T extends ImmutablePrimitive ? T : T extends infer U[] ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;

Immutable is a utility type that will make the given array/map/set/object recursively read-only.

You can use this type to easily build safe data structures.

From: https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript

Type Parameters

Type Parameter
T

Defined in

types/Immutable.ts:8