I have a web application written in TypeScript and at some point, all the output of the compiled .ts files will be minified.
Now, at some point in my code I do something like this:
class Test {
testProperty: any;
constructor() {
this.getMethods();
}
private getMethods(){
for (var method in this) {
if (method.endsWith("Method")) {
alert(method);
}
}
}
doSomethingMethod(){}
}
var x = new Test();
While I haven't done any test myself, but from what I've read (this blog post, the first comment of this SO answer ) that when minifying, all names of functions, properties and so on are altered.
Will the minification of the output of the .ts files alter this way of getting the method names? Does it depend on the type of minification?
EDIT: I introduced the output of the .ts file above in a minifier (jscompress.com) and the result is the following:
var Test=function(){function t(){this.getMethods()}return t.prototype.getMethods=function(){for(var t in this)t.endsWith("Method")&&alert(t)},t.prototype.doSomethingMethod=function(){},t}(),x=new Test;
As you can see, this minified version doesn't affect the variable names and the code kept its intended functionality.
What I want to know is : Are there minifying tools that alter the naming of your objects?