Answer the question
In order to leave comments, you need to log in
BigInt literals not available when targeting lower than ESNext?
I am installing react and typescript using yarn. Create a react app my-app --typescript.
Then I wrote this code.
import React from 'react';
const App: React.FC = () => {
const theBiggestInt = 9007199254740991n;
return (
<div>
{"Durkurian"}
</div>
);
}
export default App;
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@types/jest": "24.0.17",
"@types/node": "12.7.2",
"@types/react": "16.9.2",
"@types/react-dom": "16.8.5",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-scripts": "3.1.1",
"typescript": "3.5.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Answer the question
In order to leave comments, you need to log in
You cannot use BigInt unless you have the target property in tsconfig.json in compilerOptions set to something other than ESNext. But you should not do this, since Safari, IE and Edge do not know anything about BigInt.
BigInt. Can-i-use browser compatibility
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question