Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/max.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ expectType<number>(max(1 as number, 2 as number));
expectType<string>(max('a' as string, 'b' as string));
expectType<boolean>(max(true as boolean, false as boolean));
expectType<Date>(max(new Date(Date.now() - 1), new Date(Date.now())));
expectType<bigint>(max(1n as bigint, 2n as bigint));

// curried
expectType<(b: number) => number>(max(a));
Expand Down
2 changes: 2 additions & 0 deletions test/maxBy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type Obj = {
str: string;
date: Date;
bool: boolean;
bigint: bigint;
};

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

// Placeholder
// expectType<number>(max(__, a, b)(fn));
Expand Down
1 change: 1 addition & 0 deletions test/min.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ expectType<number>(min(1 as number, 2 as number));
expectType<string>(min('a' as string, 'b' as string));
expectType<boolean>(min(true as boolean, false as boolean));
expectType<Date>(min(new Date(Date.now() - 1), new Date(Date.now())));
expectType<bigint>(min(1n as bigint, 2n as bigint));

// curried
expectType<(b: number) => number>(min(a));
Expand Down
2 changes: 2 additions & 0 deletions test/minBy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type Obj = {
str: string;
date: Date;
bool: boolean;
bigint: bigint;
};

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

// Placeholder
// expectType<number>(max(__, b)(a));
Expand Down
2 changes: 1 addition & 1 deletion types/util/tools.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export type ObjPred<T = unknown> = (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`
Expand Down