Closed as not planned
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?