-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Suggestion moved over from codeplex.
I would like to suggest the following: Why not have anonymous/unnamed modules? The following code snippet totally makes sense for me to compile:
module {
class Simple {
constructor(public name: string) {}
greet(who: string) {
return "Greetings "+ who +", I'm "+ this.name +"!";
}
static main() {
var s = new Simple('Flynn');
console.log(s.greet("Program"));
}
}
Simple.main()
}
The generated code should be wrapped in a closure function and not cluttering the global scope.
(function () {
// ...
})();
Also it would be nice to have a compiler option to put everything compiled in an anonymous module so that the global namespace is not cluttered.
The above snippet is with little modification from: https://gist.github.com/3916195
Thanks!
Metadata
Metadata
Assignees
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScriptAn idea for TypeScript