Skip to content

Integrating with NodeJS

Steve4448 edited this page Oct 19, 2014 · 2 revisions

You can boot/load a TypeScript file in JavaScript just by requiring typeinclude and including your TypeScript file.

To do this you must first require the library; var typeinclude = require("typeinclude"); after which you may either load your TypeScript Classes by using the function:

typeinclude(script, classpath, ignoreCaches)

The argument script is the TypeScript file that you desire to load, classpath (optional) is the directory of which to find that script, and finally ignoreCaches (optional) will ignore cached version of the script and just re-compile the script every time.


Example:

var typeinclude = require("typeinclude");
typeinclude("index.ts");

Would load a file that's named "index.ts" in the current directory.

Clone this wiki locally