Creating a node application with TypeScript and ts-node

ts-node is a package that allows you to run TypeScript (.ts) files without a build step.

You can run a TypeScript project with:

ts-node src/index.ts

You can combine ts-node with nodemon to restart the application on code changes:

nodemon --watch src/**/*.ts --exec ts-node src/index.ts

You can have your tests coded in TypeScript. You might need to add this on tsconfig.json:

"include": ["**/*.ts"]

And then you will be able to run the tests with:

mocha --compilers ts:ts-node/register,tsx:ts-node/register spec/**/*.ts

You can use a gulpfile.ts and have it run by just calling gulp:

gulp
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s