From 9352cdcc3dc7c33f2ea71f140bf2b57d07f0a410 Mon Sep 17 00:00:00 2001 From: Josh Duff Date: Tue, 10 Jun 2025 15:57:42 -0500 Subject: [PATCH] add bigint to the Ord type --- test/max.test.ts | 1 + test/maxBy.test.ts | 2 ++ test/min.test.ts | 1 + test/minBy.test.ts | 2 ++ types/util/tools.d.ts | 2 +- 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/max.test.ts b/test/max.test.ts index 7ad5b6e..9a2fad7 100644 --- a/test/max.test.ts +++ b/test/max.test.ts @@ -14,6 +14,7 @@ expectType(max(1 as number, 2 as number)); expectType(max('a' as string, 'b' as string)); expectType(max(true as boolean, false as boolean)); expectType(max(new Date(Date.now() - 1), new Date(Date.now()))); +expectType(max(1n as bigint, 2n as bigint)); // curried expectType<(b: number) => number>(max(a)); diff --git a/test/maxBy.test.ts b/test/maxBy.test.ts index 92fc189..a219f82 100644 --- a/test/maxBy.test.ts +++ b/test/maxBy.test.ts @@ -6,6 +6,7 @@ type Obj = { str: string; date: Date; bool: boolean; + bigint: bigint; }; // please note how literals work in this situation @@ -20,6 +21,7 @@ expectType(maxBy(Math.abs, 1 as number, 2 as number)); expectType(maxBy(prop('str'), {} as Obj, {} as Obj)); expectType(maxBy(prop('bool'), {} as Obj, {} as Obj)); expectType(maxBy(prop('date'), {} as Obj, {} as Obj)); +expectType(maxBy(prop('bigint'), {} as Obj, {} as Obj)); // Placeholder // expectType(max(__, a, b)(fn)); diff --git a/test/min.test.ts b/test/min.test.ts index 25ab010..6c69ea1 100644 --- a/test/min.test.ts +++ b/test/min.test.ts @@ -14,6 +14,7 @@ expectType(min(1 as number, 2 as number)); expectType(min('a' as string, 'b' as string)); expectType(min(true as boolean, false as boolean)); expectType(min(new Date(Date.now() - 1), new Date(Date.now()))); +expectType(min(1n as bigint, 2n as bigint)); // curried expectType<(b: number) => number>(min(a)); diff --git a/test/minBy.test.ts b/test/minBy.test.ts index adc3413..a4f57e7 100644 --- a/test/minBy.test.ts +++ b/test/minBy.test.ts @@ -6,6 +6,7 @@ type Obj = { str: string; date: Date; bool: boolean; + bigint: bigint; }; // please note how literals work in this situation @@ -20,6 +21,7 @@ expectType(minBy(Math.abs, 1 as number, 2 as number)); expectType(minBy(prop('str'), {} as Obj, {} as Obj)); expectType(minBy(prop('bool'), {} as Obj, {} as Obj)); expectType(minBy(prop('date'), {} as Obj, {} as Obj)); +expectType(minBy(prop('bigint'), {} as Obj, {} as Obj)); // Placeholder // expectType(max(__, b)(a)); diff --git a/types/util/tools.d.ts b/types/util/tools.d.ts index d73166e..18687cd 100644 --- a/types/util/tools.d.ts +++ b/types/util/tools.d.ts @@ -324,7 +324,7 @@ export type ObjPred = (value: any, key: unknown extends T ? string /** * Values that can be compared using the relational operators `<`/`<=`/`>`/`>=` */ -export type Ord = number | string | boolean | Date; +export type Ord = number | string | boolean | Date | bigint; /** * `a` is less than `b`