New Symbol Bigint
ID |
javascript.new_symbol_bigint |
Severity |
critical |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Reliability |
Language |
JavaScript |
Tags |
reliability, runtime-error |
Description
Reports new Symbol(…) and new BigInt(…). Neither Symbol nor BigInt is a constructor: both throw a TypeError the moment the line runs, so the value is never produced and the surrounding function never returns.
const id = new Symbol("id"); // FLAW — TypeError: Symbol is not a constructor
const big = new BigInt(9007199254740993); // FLAW — TypeError: BigInt is not a constructor
Rationale
-
Both holes in the language are deliberate. A symbol is unique by construction, so an object wrapping one would give two distinct things claiming the same identity. A
BigIntobject wrapper would compare and coerce unlike the primitive it wraps. -
TC39 closed both cases by leaving the
internal slot absent, which is why the failure is immediate and total rather than a subtle misbehaviour later. -
The
newarrives by habit — every other global that produces a value (Date,Map,Error) takes it — so the line reads as correct.