From ee4d7cdc5175bcfff41d81fb8d4250943a48585e Mon Sep 17 00:00:00 2001 From: Neil Morrison Date: Sun, 7 Aug 2022 23:48:25 +0100 Subject: [PATCH] Simplifies typings on `just-compare` (#480) * Simplifies typings on `just-compare` * remove all the TS tests which are now fine --- packages/collection-compare/index.d.ts | 16 +-------------- packages/collection-compare/index.tests.ts | 24 ---------------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/packages/collection-compare/index.d.ts b/packages/collection-compare/index.d.ts index f6218bdda..c1de695f0 100644 --- a/packages/collection-compare/index.d.ts +++ b/packages/collection-compare/index.d.ts @@ -1,17 +1,3 @@ -// Definitions by: Justy Robles - -type Primitive = boolean | string | number | bigint | null | undefined; - -declare function compare(value1: T, value2: T): boolean; - -declare function compare( - value1: T1, - value2: T2 -): boolean; - -declare function compare( - value1: T1, - value2: T2 -): boolean; +declare function compare(value1: unknown, value2: unknown): boolean; export default compare; diff --git a/packages/collection-compare/index.tests.ts b/packages/collection-compare/index.tests.ts index 8198c403c..edcc495bf 100644 --- a/packages/collection-compare/index.tests.ts +++ b/packages/collection-compare/index.tests.ts @@ -50,27 +50,3 @@ const compareIt = (a: T, b: T) => compare(a, b); // Not okay // @ts-expect-error compare(); -// @ts-expect-error -compare(1, "1"); -// @ts-expect-error -compare(["abc"], "abc"); -// @ts-expect-error -compare({ a: 1, b: 2 }, [{ a: 1, b: 2 }]); -// @ts-expect-error -compare(obj2, obj1); -// @ts-expect-error -compare(obj1, obj2); -// @ts-expect-error -compare(obj1, num1); -// @ts-expect-error -compare(num1, obj1); -// @ts-expect-error -compare(NaN, "abc"); -// @ts-expect-error -compare(funcA, funcB); -// @ts-expect-error -compare(funcA, true); -// @ts-expect-error -compare(num1, num2); -// @ts-expect-error -compare(num2, num1);