Skip to content

Commit

Permalink
feat: Support for bigint on sort/sortBy/sortByKey
Browse files Browse the repository at this point in the history
  • Loading branch information
chr1sjf0x committed Dec 1, 2023
1 parent e6b4ff0 commit 17059c7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/array.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ describe("array", () => {
it("sorts using specified the specified function", () => {
expect([1, 2, 3].sortBy((n: number) => -n)).toEqual([3, 2, 1]);
});

it("works for bigint fields", () => {
// Using `any` here as an easy case for the compiler not being able to catch the error
const foos: { foo: bigint }[] = [{ foo: 3n }, { foo: -1n }, { foo: 2n }];
expect(foos.sortBy((f) => f.foo)).toEqual([{ foo: -1n }, { foo: 2n }, { foo: 3n }]);
});
});

describe("sortByKey", () => {
Expand Down

0 comments on commit 17059c7

Please sign in to comment.