es-next-tools
Version:
A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.
12 lines (11 loc) • 428 B
TypeScript
/**
* Deeply freezes an object and all its nested properties.
* @param {T} object - The object to freeze.
* @returns {T} The frozen object.
* @template T
* @example
* const obj = { a: 1, b: { c: 2 } };
* const frozenObj = deepFreeze(obj);
* // Attempting to modify frozenObj or its nested properties will throw an error in strict mode
*/
export declare function deepFreeze<T extends Record<string, any>>(object: T): T;