question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript complains about overwriting .d.ts files that are potentially known outputs

See original GitHub issue

Using tsc at the command line, I got

error TS5055: Cannot write file '/Users/alexamil/WebstormProjects/oresoftware/ldap-pool/index.d.ts' because it would overwrite input file.

why? 😃

my tsconfig.json file is as follows

{
  "compilerOptions": {
    "declaration": true,
    "baseUrl": ".",
    "types": [
      "node"
    ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "target": "es5",
    "module": "commonjs",
    "noImplicitAny": true,
    "removeComments": true,
    "allowUnreachableCode": true,
    "lib": [
      "es2015",
      "es2016",
      "es2017"
    ]
  },
  "compileOnSave": false,
  "exclude": [
    "node_modules"
  ]
}

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:12
  • Comments:25 (7 by maintainers)

github_iconTop GitHub Comments

9reactions
arcsectorcommented, May 17, 2020

At the very least there should be a flag that allows you to force an overwrite.

5reactions
iamchathucommented, Jun 26, 2019

I also have this issue. I have turned "declaration": true and it complains about build folder already generated d.ts file when i run again tsc

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot write file 'index.d.ts' because it would overwrite input file
TypeScript error: Cannot write file 'index.d.ts' because it would overwrite input file · I excluded index.ts in tsconfig temporary to solve this issue...
Read more >
Documentation - TypeScript 4.5
TypeScript 4.5 introduces a way to override a specific built-in lib in a manner similar to how @types/ support works. When deciding which...
Read more >
TypeScript: cannot write file .d.ts because it would overwrite ...
json , yet TypeScript keeps using them as input and complaining that it can't overwrite them when generating type declarations.
Read more >
Understanding TypeScript's “Compilation Process” & the ...
The TypeScript compiler compiles these files and outputs the JavaScript with .js ... The .d.ts file is a TypeScript declaration file, ...
Read more >
TypeScript errors and how to fix them
error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier. Broken Code ❌. index.d ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found