Skip to content

test: add IsEqual test cases for number vs bigint#1466

Open
DakshSinghDhami wants to merge 4 commits into
sindresorhus:mainfrom
DakshSinghDhami:main
Open

test: add IsEqual test cases for number vs bigint#1466
DakshSinghDhami wants to merge 4 commits into
sindresorhus:mainfrom
DakshSinghDhami:main

Conversation

@DakshSinghDhami

Copy link
Copy Markdown

Problem

Issue #1442 raised a question about whether IsEqual<100, 100n> should be true or false. After investigation, the current behavior (false) is correct because number and bigint are distinct types in TypeScript and use strict equality (===) in JavaScript.

Changes

  • Added test cases validating that IsEqual correctly distinguishes between number and bigint types
  • Added tests for bigint literal self-equality

Closes #1442

Daksh Dhami added 2 commits June 28, 2026 21:49
Add test cases verifying that number and bigint types are
correctly identified as distinct types by IsEqual.
Add tests covering:
- Same bigint literals (should be equal)
- Different bigint values (should be equal - same type)
- Number vs bigint literals (should not be equal)
- Number vs bigint types (should not be equal)
@sindresorhus

Copy link
Copy Markdown
Owner

#1442 is an open design discussion about whether to add a loose/numeric-equality type (ToBigint / IsLooseEqual / isNumberEqual), since math types like LessThanOrEqual<100, 100n> route through IsEqual. Adding tests for the current behavior documents the status quo but doesn't resolve that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: IsEqual<100, 100n> is False

3 participants