UNPKG

corde

Version:

A simple library for Discord bot tests

27 lines (26 loc) 806 B
import { DeepReadonly, StrictObject } from "../types"; /** * Create a new instance of the object with all public properties frozen. * public properties: properties that not starts with `_`. * * @see https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze * * @example * * const obj = { * name: "abc", * age: "aa", * values: [1, 2 ,3] * }; * * const frozen = deepFreeze(obj); * * Object.isFrozen(frozen) // True * * frozen.name = "aa"; // Error: can not assign value to read-only property * frozen.values.push = "aa"; // Error: can not add values to a read-only array * * @param obj Object to be frozen * @returns New frozen instance of the object */ export declare function deepFreeze<T extends StrictObject>(obj: T): DeepReadonly<T>;