This package will allow you to use require
on any .ts
files from any .js
files using our runtime compiler!
API
npm i ts-interpreter.js
CLI - scroll down for CLI usages
npm i ts-interpreter.js -g
- Full Enum Support
- Array / Object methods
- Class methods
-
export
/import
conversion tomodule.exports
- Statements (label, if, while, etc.)
- Try / Catch / Finally handle
- Assignments
- Keywords
- Operators
- Expressions
Click here to view samples of compiled TS to JS
- tsc compiler: 1.159s - 1.381s (8 files)
- ts-node runtime compiler: 1.052s - 1.235s (8 files)
- ts-interpreter.js runtime compiler: 32.527ms - 507.492ms (8 files)
index.js
require('ts-interpreter.js'); // register .ts extension and runtime compiler
const package = require('./main'); // main.ts gets compiled almost instant during runtime
console.log(package.whoami()); // ts-interpreter.js
main.ts
export function whoami(): string|any {
return 'ts-interpreter.js';
}
file : tsi-cli <input.ts> <out.js>
auto : tsi-cli <input.ts> - # replaces - to <input.ts>.js
console : tsi-cli <input.ts> --
project-dist: tsi-cli project-dist
run : tsi-cli run <input.js/input.ts>