Skip to content

Minification not generating the file correctly when BigInt is involved #31

@sapnc

Description

@sapnc

Installed product versions

  • Visual Studio: 2022.
  • This extension: 2.9.9

Description

The Minifier not generating the script when BigInt() method is used with a higher values.

Steps to recreate

Adding a sample code. The intention of this code is to check if the given string is well within the C# Int64 range.
let TryParseLong = function (str, defaultValue) {
var retValue = defaultValue;
if (str !== null) {
if (str.length > 0 && str.length <= 19) {
if (!isNaN(str)) {
if (BigInt(str) < BigInt("9223372036854775807")) { //Int64.MaxValue is "9223372036854775807"
retValue = BigInt(str);
}
console.log(retValue);
}
}
}

return retValue;

}

Current behavior

The minifier generates the minification file
However the BigInt("9223372036854775807") gets generated as -9223372036854775808n

The minified code generated on the machine is
let TryParseLong=function(n,t){var i=t;return n!==null&&n.length>0&&n.length<=19&&(isNaN(n)||(BigInt(n)<-9223372036854775808n&&(i=BigInt(n)),console.log(i))),i},a=123456,b=TryParseLong(a,-1);alert(b);

Expected behavior

Ideally it should stay as
9223372036854775808n

let TryParseLong=function(n,t){var i=t;return n!==null&&n.length>0&&n.length<=19&&(isNaN(n)||(BigInt(n)<9223372036854775808n&&(i=BigInt(n)),console.log(i))),i},a=123456,b=TryParseLong(a,-1);alert(b);

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions