mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[@types/deep-freeze] - allow functions to be called with out error (#37096)
* allow functions to be called * lint * fix ups
This commit is contained in:
parent
53b0020a89
commit
07b144b70a
@ -5,3 +5,6 @@ class Foo {
|
||||
}
|
||||
const foo = df(new Foo());
|
||||
const items = df([{id: 0, name: 'first'}]);
|
||||
const functionTest = df({id: 0, name: 'first', update: (blah: boolean) => blah});
|
||||
|
||||
functionTest.update(true);
|
||||
|
||||
9
types/deep-freeze/index.d.ts
vendored
9
types/deep-freeze/index.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/substack/deep-freeze
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Aluan Haddad <https://github.com/aluanhaddad>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 3.1
|
||||
|
||||
export = deepFreeze;
|
||||
|
||||
@ -11,7 +11,8 @@ declare function deepFreeze<T extends Function>(f: T): T;
|
||||
declare function deepFreeze<T>(o: T): deepFreeze.DeepReadonly<T>;
|
||||
|
||||
declare namespace deepFreeze {
|
||||
type DeepReadonly<T> = {
|
||||
readonly [P in keyof T]: DeepReadonly<T[P]>
|
||||
};
|
||||
type DeepReadonly<T> =
|
||||
T extends (...args: any) => any
|
||||
? T
|
||||
: { readonly [P in keyof T]: DeepReadonly<T[P]> };
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user