Skip to content

bigint not loosely comparable to number #48767

Closed
@Trevor-Strong

Description

@Trevor-Strong

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions