Open
Description
Bug Report
π Search Terms
- bigint
- bitwise
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about bigint.
β― Playground Link
π» Code
//@target: ES2020
const v1 = 1n as any;
const v2 = 2n as never;
const v3 = v1 | v2; // v3 should be typed (number | bigint), but is number
π Actual behavior
The result of the bitwise operations &
, |
, ^
and ~
is assumed to be a number
when all the operands have unspecified type, like any
or never
.
π Expected behavior
The result of bitwise operations with unspecified type operands should be number | bigint
.