TypeScript Node

1 min read typescript

Written in 2016. Tools, APIs and prices may have changed since.

Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/typescript-node-playground.

example app showing how to setup and develop a typescript based node app using the typings TypeScript Definition Manager

Initial Setup

$ npm init --force

$ typings install --ambient node

$ npm install request --save
$ typings install --ambient request

// tsc was complaining about `form-data`
$ typings install --ambient form-data

// for `Promise`, `Object.assign`, etc.
$ typings install --ambient es6-shim

// compile from .ts to .js
$ tsc

Developing

// live re-compile and re-run on changes via nodemon
$ npm run dev

// NOTE: app will be ran 2xs on every change when editing in Atom since atom-typescript will re-compile also in addition to `tsc -w` in the `dev` npm script

Keep learning

Get new guides and courses by email

An occasional email when I publish a new guide, course or post. No spam, and you can unsubscribe any time.

Sent with Buttondown. I never share your address. Prefer a feed? Use the RSS feed.