Appendix A. TypeScript installation and source code
Online
For simple code, such as trying out some code samples without dependencies, you can use the online TypeScript playground at https://www.typescriptlang.org/play.
Local
To install locally, you first need Node.js and npm, the Node Package Manager. You can get them at https://www.npmjs.com/get-npm. When you have those, run npm install -g typescript to install the TypeScript compiler.
You can compile a single TypeScript file by passing it as an argument to the TypeScript compiler, such as tsc helloworld.ts. TypeScript compiles to JavaScript.
For projects that contain multiple files, a tsconfig.json file is used to configure the compiler. Running tsc with no arguments from a directory ...
Get Programming with Types now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.