mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
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:
@@ -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'}]);
|
||||
|
||||
Vendored
+8
-6
@@ -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]> }>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// This package uses the Function type to align with lib.d.ts
|
||||
"ban-types": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user