TypeScript makes alluring promises regarding one's development experience. Why not fiddle with the code to see it in practice? First, we have to create a dedicated directory for upcoming samples. We initialize the project by running npm init -y and install typescript as a dev dependency:
npm i -D typescript
In the manifest scripts section, we add a command to compile sources with TypeScript:
package.json
{ ... "scripts": { "build": "tsc" }, ... }
We need to let TypeScript know what exactly we want from it. We will describe that in the configuration file:
tsconfig.json
{ "compilerOptions": { "target": "ES6", "module": "CommonJS", "moduleResolution": "node", "sourceMap": true...