1
votes

Any examples of using AMD with TypeScript and dojo AMD? Keep getting "3" instead of an object (tslab == 3):

    require( ["TypeScriptLab"], function ( tslab )
    {
        new tslab.Tests().run();
    } );

The TypeScript looks like this:

export class TypeScriptLab {
    test() {
    }
}

The generated JS looks like this:

define(["require", "exports"], function(require, exports) {
    var TypeScriptLab = (function () {
        function TypeScriptLab() { }
        TypeScriptLab.prototype.test = function () {
        };
        return TypeScriptLab;
    })();
    exports.TypeScriptLab = TypeScriptLab;    
})
1
Neglected to mention I'm using dojo 1.8.0 - Corey Alix

1 Answers

1
votes

I defined my packages:

<script>
    dojoConfig = {
        async: true,
        packages: [
            { name: "TSLab", location: "/IPS" }
        ]
    };
</script>

And added a namespace prefix:

    require( ["TSLab/typeScriptLab"], function ( tslab )
    {
        new tslab.Tests().run();
    } );

And the module now loads.