Skip to content

bigint not loosely comparable to number #48767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Trevor-Strong opened this issue Apr 19, 2022 · 3 comments
Closed

bigint not loosely comparable to number #48767

Trevor-Strong opened this issue Apr 19, 2022 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@Trevor-Strong
Copy link

Bug Report

Currently, tsc sees this as an error stating

This condition will always return 'false' since the types 'number' and 'bigint' have no overlap.
which is not the case. The spec for bigint, which states that an expression like 1n == 1 would
be true since, conceptually, 1 and 1n are the same value.

🔎 Search Terms

number, bigint, loose equals

💻 Code

console.log(1 == 1n);

🙁 Actual behavior

This creates an error at compile time since tsc thinks that 1 == 1n will never be true, which is simply not the case.

@MartinJohns
Copy link
Contributor

Duplicate of #30540. Used search terms: bigint number in:title

@Trevor-Strong
Copy link
Author

@MartinJohns Thank you for the tip. My bad

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Apr 19, 2022
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants