我相信我现在应该能够在TypeScript...but中使用BigInt,改变一些代码库来使用它,我得到了“找不到名字'BigInt‘。(2304)”有没有想过为什么我会得到这个错误?
$ cat test.ts
let x = BigInt(123)
console.log(x.toString())
$ tsc test.ts
test.ts:1:9 - error TS2304: Cannot find name 'BigInt'.
1 let x = BigInt(123)
~~~~~~
Found 1 error.
如何开始在TypeScript中使用BigInt?
发布于 2021-02-15 16:13:47
在我例子中,我应该将"node“添加到tsconfig.json中的类型中
{
"compilerOptions": {
"target": "esnext",
"outDir": "build/module",
"module": "esnext",
"types": ["node"]
},
"exclude": [
"node_modules/**"
]
}
https://stackoverflow.com/questions/59456390
复制相似问题