Getting ready
To use TypeScript in Node.js, we will need to install the typescript library via NPM and save it in our Express package.json file. You will also want to install TypeScript globally so that we can use the tsc command to manually compile our TypeScript files:
npm install typescript --savenpm install typescript -g
Working with TypeScript will also require us to import type definitions for the various libraries we are using for our project. When first getting started, can seem a bit daunting to convert to using TypeScript. If you are already working with many external libraries, you should check out to the definitelyTyped project, to see whether any of the libraries you are using already have type definitions provided:
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access