Constructor parameters of BigInt
which is lost BigInt
, String
, Boolean
, Number
type
#57283
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
⚙ Compilation target
ES2020
⚙ Library
TypeScript
Missing / Incorrect Definition
Sample Code
Documentation Link
We can see in 21.2.1.1 BigInt ( value ) that
2. Let prim be ? ToPrimitive(value, NUMBER).
corresponds to our situation and triggersToPrimitive
.ToPrimitive
attempts to retrieve thevalueOf
method of theObject
. ForBigInt
,Number
,String
, andBoolean
, this method exists, allowing us to obtain a corresponding primitive value. Then, based on thepreferredType
ofNUMBER
, it is further converted to a number.Our problem is essentially answered here, indicating that we should support
Boxed Types
as input.about
The text was updated successfully, but these errors were encountered: