Skip to content

Commit b6a861d

Browse files
authored
update(Ord) add bigint to the Ord type (#139)
1 parent 13d36d5 commit b6a861d

5 files changed

Lines changed: 7 additions & 1 deletion

File tree

test/max.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ expectType<number>(max(1 as number, 2 as number));
1414
expectType<string>(max('a' as string, 'b' as string));
1515
expectType<boolean>(max(true as boolean, false as boolean));
1616
expectType<Date>(max(new Date(Date.now() - 1), new Date(Date.now())));
17+
expectType<bigint>(max(1n as bigint, 2n as bigint));
1718

1819
// curried
1920
expectType<(b: number) => number>(max(a));

test/maxBy.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type Obj = {
66
str: string;
77
date: Date;
88
bool: boolean;
9+
bigint: bigint;
910
};
1011

1112
// please note how literals work in this situation
@@ -20,6 +21,7 @@ expectType<number>(maxBy(Math.abs, 1 as number, 2 as number));
2021
expectType<Obj>(maxBy(prop('str'), {} as Obj, {} as Obj));
2122
expectType<Obj>(maxBy(prop('bool'), {} as Obj, {} as Obj));
2223
expectType<Obj>(maxBy(prop('date'), {} as Obj, {} as Obj));
24+
expectType<Obj>(maxBy(prop('bigint'), {} as Obj, {} as Obj));
2325

2426
// Placeholder
2527
// expectType<number>(max(__, a, b)(fn));

test/min.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ expectType<number>(min(1 as number, 2 as number));
1414
expectType<string>(min('a' as string, 'b' as string));
1515
expectType<boolean>(min(true as boolean, false as boolean));
1616
expectType<Date>(min(new Date(Date.now() - 1), new Date(Date.now())));
17+
expectType<bigint>(min(1n as bigint, 2n as bigint));
1718

1819
// curried
1920
expectType<(b: number) => number>(min(a));

test/minBy.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type Obj = {
66
str: string;
77
date: Date;
88
bool: boolean;
9+
bigint: bigint;
910
};
1011

1112
// please note how literals work in this situation
@@ -20,6 +21,7 @@ expectType<number>(minBy(Math.abs, 1 as number, 2 as number));
2021
expectType<Obj>(minBy(prop('str'), {} as Obj, {} as Obj));
2122
expectType<Obj>(minBy(prop('bool'), {} as Obj, {} as Obj));
2223
expectType<Obj>(minBy(prop('date'), {} as Obj, {} as Obj));
24+
expectType<Obj>(minBy(prop('bigint'), {} as Obj, {} as Obj));
2325

2426
// Placeholder
2527
// expectType<number>(max(__, b)(a));

types/util/tools.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export type ObjPred<T = unknown> = (value: any, key: unknown extends T ? string
324324
/**
325325
* Values that can be compared using the relational operators `<`/`<=`/`>`/`>=`
326326
*/
327-
export type Ord = number | string | boolean | Date;
327+
export type Ord = number | string | boolean | Date | bigint;
328328

329329
/**
330330
* `a` is less than `b`

0 commit comments

Comments
 (0)