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 |
|
7 | export = deepFreeze;
|
8 |
|
9 | declare function deepFreeze<T>(a: T[]): ReadonlyArray<deepFreeze.DeepReadonly<T>>;
|
10 | declare function deepFreeze<T extends Function>(f: T): T;
|
11 | declare function deepFreeze<T>(o: T): deepFreeze.DeepReadonly<T>;
|
12 |
|
13 | declare namespace deepFreeze {
|
14 | type DeepReadonly<T> =
|
15 | T extends (...args: any) => any
|
16 | ? T
|
17 | : { readonly [P in keyof T]: DeepReadonly<T[P]> };
|
18 | }
|