-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed as not planned
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
π Search Terms
"minus operator", "minus bigint", "minus any"
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about "operator"
β― Playground Link
π» Code
const a:any = 10n
let b = -a
b += 5
// - tsc: no error
// - run: can't convert BigInt to numberπ Actual behavior
b type is number
π Expected behavior
b type should be number | bigint
Additional information about the issue
Here's another example showing that other operators can potentially be affected
class A { [Symbol.toPrimitive] = () => 1n }
const a: A = new A()
const b = a.valueOf()
const c = -a
const d = ~a
// `b`, `c` and `d` types shound be `bigint`, right?Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created