Skip to content

"duplicate identifier" error in js files produced by tsc #7077

Closed
@d180cf

Description

@d180cf

Let's say we have the following ts file:

function abc() {
  // ...
}

module abc {
  export const def = 123;
}

tsc converts this into the following js file:

function abc() {
  // ...
}

var abc;
abc.def = 123; // well, there is actually a function (abc) { ... } wrapper here

Now if I try to include this js file into another ts file, tsc will scan the js file it's just generated and will report an error: "duplicate identifier abc". Once the "var abc" part is removed, the error goes away. Tried with the latest typescript@next (which was 1.9.0-dev.20160214).

The good news is that this is the only error I'm getting from a exceptionally sophisticated js file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions