-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"duplicate identifier" error in js files produced by tsc #7077
Comments
We could do the work to not emit the |
I'm actually thinking that emitting the error isn't correct in this case: an empty "var" should be a noop if the var was already declared. |
@d180cf as per the JS semantics, the additional var is a no-op. the typescript compiler imposes a bit stricter semantics here; the assumption here is that you did that be mistake and you did not mean to re-declare the variable, and that might point you to an actual bug, either related to scoping or incorrect use. |
If one uses outDir and exclude options wouldn't this be avoided altogether 🌹 |
PRs welcomed! |
@mhegazy we should probably hold off on PRs for this until after the tree transforms work comes in? Don't want to solicit throwaway work |
that is correct. here is the issue to look out for: #5595 |
This is fixed |
Let's say we have the following ts file:
tsc converts this into the following js file:
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.
The text was updated successfully, but these errors were encountered: