TypeScript Node
![Test coverage](https://img.shields.io/coveralls/blakeembrey/ts-node.svg?style=flat)
TypeScript execution environment for node. Works with typescript@>=1.5
.
Installation
npm install -g ts-node
npm install -g typescript
Features
![TypeScript REPL](https://github.com/blakeembrey/ts-node/raw/master/screenshot.png)
- Execute TypeScript files with node
- Interactive REPL
- Execute (and print) TypeScript through the CLI
- Supports source maps
- Supports
tsconfig.json
Usage
ts-node script.ts
ts-node
ts-node -e 'console.log("Hello, world!")'
ts-node -p '"Hello, world!"'
Mocha:
mocha test.ts --require ts-node/register src/**/*.spec.ts
Tape:
ts-node tape src/**/*.spec.ts
Loading tsconfig.json
Typescript Node automatically loads tsconfig.json
options and referenced files from the current directory using tsconfig.
Configuration Options
You can set options by passing them in before the script.
ts-node --compiler ntypescript --project src --ignoreWarnings 2304 hello-world.ts
- project Location to resolve
tsconfig.json
from. - compiler Use a custom, require-able TypeScript compiler compatible with
typescript@>=1.5.0-alpha
. - ignoreWarnings Set an array of TypeScript diagnostic codes to ignore.
- disableWarnings Ignore all TypeScript errors.
Programmatic Usage
require('ts-node').register({ })
require('ts-node/register')
License
MIT