我跑步时有问题 tsc
error TS5055: Cannot write file 'index.d.ts' because it would overwrite input file.
Run Code Online (Sandbox Code Playgroud)
我的tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"newLine": "LF",
"preserveConstEnums": true,
"pretty": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules",
"typings"
]
}
Run Code Online (Sandbox Code Playgroud)
该问题在以下情况下得以解决:
index.ts在tsconfigtsc index.tsdeclaration在关闭tsconfigindex为另一个名称!
例如,在package.json中更改打字稿主文件时,我遇到了相同的问题:将index.ts重命名为foo.ts
更改package.json为
"typescript": {
"main": "foo.ts"
}
Run Code Online (Sandbox Code Playgroud)
tsc错误:
error TS5055: Cannot write file 'index.d.ts' because it would overwrite input file. …Run Code Online (Sandbox Code Playgroud) typescript ×1