What about sweet.js renaming top level variables to Typescript output?
Typescript compiles
class ClassName { }
to
var ClassName = function () {
function ClassName() {
}
return ClassName;
}();
I am running this JS code through sweet.js, which even without macros creates something like this:
var ClassName$659 = function () {
function ClassName$663() {
}
return ClassName$663;
}();
I understand that sweet.js would not rename the first occurrence ClassName
if the top level was var
not used, or if a different name was used for the constructor function, but it's the Typescript compiler that does these things, not me.
Why is this a problem
- I can't use
ClassName
in HTML files anymore . This is not something I want to do often, and of course I will always do without opportunity, but I still miss it. - The macros I want to use this far don't require any hygienic renaming. But now it seems to me that I will have to undo the rename with my own script. Source maps won't help easily as I already need a source map for the Typescript -> javascript conversion.
My question
Is there a way to disable hygienic renaming in sweet.js? Is there a better way to deal with this problem?
+3
source to share