Home > @gglib/utils > Immutable

Immutable type

Signature:

export declare type Immutable<T> = T extends Primitive ? T : T extends Function ? T : T extends Date ? T : T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer U> ? ReadonlySet<U> : T extends {} ? {
    readonly [K1 in keyof T]: Immutable<T[K1]>;
} : Readonly<T>;

References: Primitive, Immutable