Kersten Kersten - 8 months ago 75
TypeScript Question

module.exports in typescript

does somebody know how to do a module.exports?

I tried some different ways ending up with

export class Greeter {}


which will compile to

exports.Greeter = Greeter;


But what I really want is this:

exports = Greeter;


So that I can use it like this:

import Greeter = module("Greeter");
var greeter = new Greeter();


and not

import Greeter = module("Greeter");
var greeter = new Greeter.Greeter();


Is this possible with Typescript?

Answer

This has now been implemented and is ready in TypeScript 0.9 :)