What is Typescript?
Static Types is one of the main functionalities in Typescript, but it is completely optional.
Why do I need to learn Typescript?
Modern web development is leaning towards React and Angular to a great extent.
The latest polls say that more than half of React developers are using Typescript, even if you don’t use it, you’ll find many examples and components in Typescript.
Angular is tightly coupled with Typescript.
Typescript includes most of the functionality of ES6 and ES7 like class and arrow functions.
You will get a more robust code, fewer bugs, more predictable and as it is increasingly popular you’ll find many examples and codebases in Typescript, it is becoming a must on the front-end space.
We need node installed, we just need to type to install typescript globally:
npm install -g typescript
tsc example.ts example.js
The second parameter is not required if we just want the same filename with a different extension.
We can have a daemon process watching for changes in the file to recompile the ts file constantly by using:
tsc example.ts -w
The tsconfig.json file is used to configure how Typescript works:
- You can create the tsconfig.json file by using
- Enable sourceMaps for debugging.