does somebody know how to do a module.exports?
I tried some different ways ending up with
export class Greeter
So I think I've found a workaround. Just wrap the keyword 'module' in parentheses in your .ts file:
declare var module: any;
(module).exports = MyClass;
The generated javascript file will be exactly the same:
(module).exports = MyClass;
Note, better than declaring var module yourself, download the node.d.ts definition file and stick it in the same directory as your typescript file. Here is a complete sample of an express node.js routing file which assumes node.d.ts is in same directory:
///
var SheetController = function () {
this.view = function (req, res) {
res.render('view-sheet');
};
};
(module).exports = SheetController;
I can then new up a SheetController and (using express) assign the view method:
var sheetController = new SheetController();
app.get('/sheet/view', sheetController.view);
I suppose any keyword can be escaped using this pattern:
declare var reservedkeyword: any;
(reservedkeyword).anything = something;