Skip to content

[bug] tsc error: cannot write file 'main.d.ts' because it would overwrite input file #8468

@alimd

Description

@alimd

Excuse me for writing my question here but i guess its a bug.

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"
      ]
    }

TypeScript Version: 1.8.10

This issue solved when:

  1. Exclude index.ts in tsconfig
  2. Run tsc index.ts
  3. Turn declaration off in tsconfig
  4. Rename indextx to foo.ts!

I have same issue when i rename index.ts to foo.ts and 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 index 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 and excuse me again for asking my question here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions