Reputation: 165
Typescript compiles
class ClassName { }
to
var ClassName = function () {
function ClassName() {
}
return ClassName;
}();
I run that JS code through sweet.js, which even when there are no macros defined, produces something like this:
var ClassName$659 = function () {
function ClassName$663() {
}
return ClassName$663;
}();
I understand that sweet.js would not rename the first occurrence of ClassName
if the top-level var
wasn't used, or if a different name was used for the constructor function, but it's the Typescript compiler that does those things, not me.
ClassName
in HTML files. That's not something I want to do often, and I can of course always do without the capability, but I still miss having it. Is there a way to disable hygienic renaming in sweet.js? Is there a better way to deal with this issue?
Upvotes: 3
Views: 358
Reputation: 165
Using the --readable-names flag with sjs, as @AnthonyCalandra suggested, resolved my problem.
Upvotes: 2
Reputation: 31147
Is there a way to disable hygienic renaming in sweet.js?
No.
Is there a better way to deal with this issue?
Not sure. As a hack you can post-process the file with a script that searches for ClassName$xxx and then add
var ClassName = ClassName$xxx;
Upvotes: 1