diff --git a/types/shallow-equals/index.d.ts b/types/shallow-equals/index.d.ts new file mode 100644 index 0000000000..7d91b03923 --- /dev/null +++ b/types/shallow-equals/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for shallow-equals 1.0 +// Project: https://github.com/hughsk/shallow-equals +// Definitions by: Ross Solomon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = shallow_equals; + +declare function shallow_equals( + a?: A, + b?: B, + compare?: (objA: A, objB: B) => boolean, +): boolean; diff --git a/types/shallow-equals/shallow-equals-tests.ts b/types/shallow-equals/shallow-equals-tests.ts new file mode 100644 index 0000000000..87512c9f43 --- /dev/null +++ b/types/shallow-equals/shallow-equals-tests.ts @@ -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); diff --git a/types/shallow-equals/tsconfig.json b/types/shallow-equals/tsconfig.json new file mode 100644 index 0000000000..83137182f4 --- /dev/null +++ b/types/shallow-equals/tsconfig.json @@ -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"] +} diff --git a/types/shallow-equals/tslint.json b/types/shallow-equals/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/shallow-equals/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}