In-memory (string-in/string-out) TypeScript compiler


typestring is a simple JavaScript module providing an in-memory (string-in and string-out) TypeScript compiler.

$ npm install typestring
var ts = require('typestring');
ts.compile('class Foo { public bar = 2; }');

Output string:

var Foo = (function () {
    function Foo() {
        this.bar = 2;
    return Foo;

File references can be used, but the file contents must be passed to compile as strings or buffers:

ts.compile('/// <reference path="foo.ts" />', {
  'foo.ts': fs.readFileSync('lib/foo.ts')

typestring is released under the terms of the MIT license. See LICENSE.