This project is read-only.

Extend "define" for declared module names

Topics: General, Language Specification
Apr 6, 2014 at 4: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) {
   = name;
        Animal.prototype.move = function (meters) {
            alert( + " moved " + meters + "m.");
        return Animal;

    var Horse = (function (_super) {
        __extends(Horse, _super);
        function Horse(name) {
  , name);
        return Horse;
    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.