Skip to content

Cannot use bigint with any in certain arithmetic expressions #41741

Closed
@abacabadabacaba

Description

@abacabadabacaba

TypeScript Version: 4.2.0-dev.20201130

Search Terms: is:issue bigint

Code

var x: any, y: bigint
-x + y
++x + y
x++ + y
~x + y
x - x + y
x * x + y

Expected behavior:

The code should compile without errors, because x could be a bigint.

Actual behavior:

Each of the expressions fails to typecheck: error TS2365: Operator '+' cannot be applied to types 'number' and 'bigint'..

Playground Link: link

Related Issues: none.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions