I have issue when run tsc
error TS5055: Cannot write file 'index.d.ts' because it would overwrite input file.
my tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"newLine": "LF",
"preserveConstEnums": true,
"pretty": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules",
"typings"
]
}
This issue solved when:
- exclude
index.tsintsconfig - run
tsc index.ts - Turn
declarationoff intsconfig - rename
indexto another name!
I have same issue when change typescript main file in package.json
for example: rename index.ts to foo.ts
change package.json to
"typescript": {
"main": "foo.ts"
}
tsc error:
error TS5055: Cannot write file 'index.d.ts' because it would overwrite input file.
content of file no mater, any code content has same issue!
What can i do for fix it ?
Source code: https://github.com/AliMD/Node.js-Telegram-Bot-API/tree/v0.0.2-0
Thank you in advance.
index.tsintsconfigtemporary to solve this issue and runtsc index.tsseparately whenindex.tschanged! :(index.d.tsin your code somewhere, then when you compile, the compiler thinks thatindex.d.tsis part of the source and therefor throw that error. just a thought."declaration": true?