I am trying to pass an Int64
number from a .Net
service into javascript while maintain the precision using BigInt
.
It seems however that Javascript is rounding this number before I can cast it as a BigInt.
In the service, I am returning the Int64 number 636904216084035679
.
The following Javascript calls this service, and logs both a BigInt and JS number. The results are 636904216084035712n
and 636904216084035700
respectively.
Services.ClientService.GetClientToken(function (clientToken)
{
console.log(BigInt(clientToken));
console.log(clientToken);
resolve(BigInt(clientToken));
}, function ()
{
reject();
});
Clearly the 'clientToken' variable is being incorrectly set as a number type when the function is called which is losing the accuracy required. Any thoughts on how to pass Int64 numbers from a service?