No description, website, or topics provided.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.npmignore
LICENSE
README.md
package.json

README.md

JR-TYPESCRIPT

A jr job for typescript.

Example

var jrTypeScript = require('jr-typescript');

jrTypeScript({
  files: [ 'main.ts' ],
  options: {
    out: 'program.js'
  }
}, function (err) {
  if (err) {
    console.log(err);
  }
});

Given main.ts:

/// <reference path="greeter.ts" />

var greeter = new Greeter("world");
greeter.greet();

and greeter.ts:

class Greeter {
    greeting: string;
    constructor(message: string) {
        this.greeting = message;
    }
    greet() {
        return "Hello, " + this.greeting;
    }
}

this writes program.js:

var Greeter = (function () {
    function Greeter(message) {
        this.greeting = message;
    }
    Greeter.prototype.greet = function () {
        return "Hello, " + this.greeting;
    };
    return Greeter;
})();
var greeter = new Greeter("world");
greeter.greet();

Details

Jr-typescript is a function that compiles TypeScript files into JavaScript files. Although designed to be used with jr, it does not depend on jr and can be used by itself.

Jr-typescript is a thin wrapper around the command-line TypeScript compiler 'tsc'. The 'files' array indicates the set of TypeScript files to compile. The 'options' object controls other aspects of the compilation, such as the output file; see 'tsc --help' for details. The options are specified using their long form without the leading hyphens, so "--out" becomes "out".