allowJs option with namespaces #9474
Labels
Domain: JavaScript
The issue relates to JavaScript specifically
Needs Proposal
This issue needs a plan that clarifies the finer details of how it could be implemented.
Suggestion
An idea for TypeScript
I am currently trying to put the compiler option "allowJs" to use. My goal is to convert an existing JavaScript application into TypeScript step by step. The application does not use (external) modules, so I'm converting the JavaScript namespaces into real TypeScript namespaces, but I'm running into "duplicate identifier" errors as outlined below. Shouldn't it be possible to combine TypeScript and JavaScript using the same namespace? Maybe I'm doing something wrong or this is not intended, but I expected this to work.
TypeScript Version: 1.8.10
Code
File 1:
File 2:
tsconfig.json
Expected behavior:
Bundling the compiled code of file 1 and the code of file 2 without modifications into a single JavaScript file.
Actual behavior:
The compilation is done, but the compiler throws an error: "error TS2300: Duplicate identifier 'myapp'."
The text was updated successfully, but these errors were encountered: