Merge pull request #28094 from rsolomon/rsolomon/shallow-equals

Add definition for shallow-equals
This commit is contained in:
Benjamin Lichtman
2018-08-15 13:49:51 -07:00
committed by GitHub
4 changed files with 50 additions and 0 deletions

12
types/shallow-equals/index.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
// Type definitions for shallow-equals 1.0
// Project: https://github.com/hughsk/shallow-equals
// Definitions by: Ross Solomon <https://github.com/rsolomon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = shallow_equals;
declare function shallow_equals<A, B>(
a?: A,
b?: B,
compare?: (objA: A, objB: B) => boolean,
): boolean;

View File

@@ -0,0 +1,19 @@
import shallowEquals = require('shallow-equals');
interface A {
foo: string;
}
interface B {
foo: string;
bar?: string;
}
const a: A = { foo: 'bar' };
const b: B = { foo: 'baz' };
function compare(a: A, b: B) {
return false;
}
shallowEquals(a, b);
shallowEquals(a, b, compare);

View File

@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "shallow-equals-tests.ts"]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}