Closed as not planned
Closed as not planned
Description
TypeScript Version: 3.7.0-dev.20190907
Search Terms: numeric literal max value 9007199254740992 9007199254740993
Code
const ts = require("typescript");
const sourceFile = ts.createSourceFile("temp.ts", "9007199254740993", 99);
const literal = sourceFile.statements[0].expression;
// '9007199254740992'
console.log("Actual .text:", literal.text);
// '9007199254740993'
console.log("Expected .text:", literal.getText(sourceFile));
Expected behavior:
.text
should be the direct textual representation of the literal's value, right?
Actual behavior:
...some kind of rounding behavior related to being above Number.MAX_SAFE_INTEGER
?
Playground Link: https://astexplorer.net/#/gist/8ee21b9bb7973f0d0118658496cec5ec/9dcea811268d39e678732414b53d608e37747a63 - since this is an AST parser issue
Related Issues: Discovered while writing a codefix for #29863. 😆