Extend "define" for declared module names

Topics: General, Language Specification
Apr 6, 2014 at 3:39 PM
I have been looking extensively for a feedback portal for discussion on Typescript, but cannot find one (something similar to uservoice) - is this discussion area the appropriate venue for such, then?

One of my biggest problems with typescript so far is that its integration with RequireJS always assumes the very bare minimum implementation. You have to simply declare "export [class]" or "export [function]".

But module loading is more robust than that - is it possible to extend add a new keyword to the typescript compiler? Perhaps called "named" that can take a string?
export class Horse extends Animal implements IAnimal named "Horsie" {
    constructor(name: string) { super(name); }
}
Which would allow interpreters to use explicit module names for better organization and behavior. This would essentially compile to ...
define("Horsie", ["require", "exports"], function(require, exports) {
    var Animal = (function () {
        function Animal(name) {
            this.name = name;
        }
        Animal.prototype.move = function (meters) {
            alert(this.name + " moved " + meters + "m.");
        };
        return Animal;
    })();

    var Horse = (function (_super) {
        __extends(Horse, _super);
        function Horse(name) {
            _super.call(this, name);
        }
        return Horse;
    })(Animal);
    exports.Horse = Horse;
});
I get that this isn't that cut and dry, but it has driven me nuts since I started to use Typescript. It has made organizing projects a little more frustrating than it should have been.