ts-runner
v0.3.1
Published
Executes TypeScript, including references, in node by transpiling to JavaScript on the fly.
Downloads
9
Readme
ts-runner
Executes TypeScript, including references, in node by transpiling to JavaScript on the fly.
API
tsRunner.run(sourcePath, _this, _arguments, options, tempFilename)
:
Compiles TypesScript code and executes in the given node context (supplied by _this
and _arguments
). Any errors will be passed to console.error
.
sourcePath
(string, required): The path of the TypeScript file to compile. References will be followed._this
(object, required): Object to use asthisArg
when executing the compiled JavaScript._arguments
(array, required): The node arguments (exports, require, module, __filename, __dirname) to use when executing the compiled JavaScript.options
(string, optional): Options to pass totsc
, for example, '--noImplicitAny'. The default is an empty string.tempFilename
(string, optional): The path to a temporary file to pass totcs
. The default is './__temp.js'. This file is deleted immediately after compilitation completes.
Usage
'use strict';
let tsRunner = require('ts-runner');
tsRunner.run('./implementation/index.ts', this, arguments, '--noImplicitAny');
Versions
0.3.1
- attempt to find correct source path
0.3.0
- use current version of TypeScript compile
0.2.0
- update to use
tsc
full compile
0.1.1 - 0.1.3
- minor updates - linting, readme (no functional changes)
0.1.0
- initial implementation