这是我的typescript配置
$ npx tsc --showConfig
{
"compilerOptions": {
"target": "es2021",
"lib": [],
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"files": [
"./index.ts", ]
}
这是index.ts
:
const a = 1n;
当我尝试运行tsc
时,我得到这个输出
$ npx tsc index.ts
error TS2737: BigInt literals are not available when targeting lower than ES2020.
为什么我得到这个错误?我的tsconfig文件有什么问题吗?
如果使用文件名作为参数运行tsc
,则tsconfig.json
将被忽略。
使用--target
参数,或者不使用index.ts
tsc