UNPKG

711 BTypeScriptView Raw
1// Type definitions for deep-freeze 0.1
2// Project: https://github.com/substack/deep-freeze
3// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Aluan Haddad <https://github.com/aluanhaddad>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 3.1
6
7export = deepFreeze;
8
9declare function deepFreeze<T>(a: T[]): ReadonlyArray<deepFreeze.DeepReadonly<T>>;
10declare function deepFreeze<T extends Function>(f: T): T;
11declare function deepFreeze<T>(o: T): deepFreeze.DeepReadonly<T>;
12
13declare namespace deepFreeze {
14 type DeepReadonly<T> =
15 T extends (...args: any) => any
16 ? T
17 : { readonly [P in keyof T]: DeepReadonly<T[P]> };
18}