The javascript is built for client-side application handling and after introducing of node js we can handle the server-side also that is the database interaction also can be handled by javascript also, Now typescript is the superset of javascript, That is if you write code in javascript and save that as a .ts extension and compile and run it, the typescript will work correctly. In this typescript tutorial we are going to learn all about typescript one by one.
Audiences of typescript:
The developer is from the main object-oriented programming background will like typescript most as it is designed as other popular object-oriented programming languages like java or c#. The typescript is good looting support and programming language also.
What needed for learning typescript:
A programmer who wish to learn typescript should have the knowledge of object-oriented programming language and also a basic knowledge of javascript. and also need to have install node.js and have to install typescript globally also needed a good code editor, I prefer visual studio code as a code editor.
What is typescript?
In one word typescript is javascript with some additional features for ERP label application development.
In detail typescript is designed by Anders Hejlsberg at Microsoft who is the designer of C#. The typescript is object-oriented, compiled, strongly typed language. It can be said that the typescript is the superset of javascript which becomes javascript after compilation. It is both a set of tools and a computer language.
The features of typescript:
- Typescript is javascript with some additional features – So if one writes javascript code only and saved the file as .ts extension it will work correctly.
- Typescript Supports Other javascript libraries – so if a developer wants to include some other libraries in typescript then also it will work correctly.
- Typescript is portable – and that is why typescript can be port to any device, os, or browser. Typescript can run where javascript can run for that does not need any virtual machine or runtime environment dedicated to typescript to execute it.
Why should use typescript:
The many popular js frameworks like angular 2 and above are using typescript. so the first benefit of learning typescript is you can learn many other frameworks easily which using typescript. There are so many other benefits also, describing them one by one below.
- Compilation – Javascript does not compile during code writing so if there is a mistake it is very difficult to detect the issue for the developer but typescript compiles the code and using node.js it shows if there are any errors. Also javascript does not show any output if it’s not running in a browser but using node we can see the output easily.
- Typescript is Strongly typed: It will provide errors if we done any mistake on the declaration of variable or function so it becomes very helpful to prevent type mismatch unlike javascript.
- Typescript supports type definition: so we can use any javascript library easily using .d.ts extension.
- Object-Oriented Programming language: Typescript is object-oriented so its very easy to grab for the developer who is from java or c# background. And it also provides the reusability of the code.
Typescript’s Components:
there are 3 components of typescript and they are as described below,
- language: it compares the keyword, syntax, and types.
- Compiler: The compiler compiles the .ts file by command tsc, the command looks like tsc .ts (the extension .ts is optional)
- language Services: The language is an additional layer around the pipeline of the core compiler. It supports signature help, statement completion, code formatting, and so on.
I hope the TypeScript tutorial overview becomes helpful for you and also I am able together some interest to learn typescript in you.