Merge pull request #16654 from aluanhaddad/patch-5

deep-freeze: Updated to use Mapped Types and align with Object.freeze in lib.d.ts
This commit is contained in:
Daniel Rosenwasser
2017-06-01 00:59:28 -07:00
committed by GitHub
3 changed files with 18 additions and 10 deletions
+3 -4
View File
@@ -1,8 +1,7 @@
import df = require('deep-freeze');
class Foo {
foo: string;
foo: string;
}
var foo:Foo = df(new Foo());
const foo = df(new Foo());
const items = df([{id: 0, name: 'first'}]);
+8 -6
View File
@@ -1,13 +1,15 @@
// Type definitions for deep-freeze
// Type definitions for deep-freeze 0.1
// Project: https://github.com/substack/deep-freeze
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
declare var deepFreeze: DeepFreeze.DeepFreezeInterface;
export = deepFreeze;
declare namespace DeepFreeze {
export interface DeepFreezeInterface {
<T>(obj: T): T;
}
declare function deepFreeze<T>(a: T[]): ReadonlyArray<deepFreeze.DeepReadonly<T>>;
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]> }>;
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
// This package uses the Function type to align with lib.d.ts
"ban-types": false
}
}