TypeScript Environment SetUP: It is an Open Source technology. We can run on any browser, any host, and any OS. We will following the tools to write and test a Typescript program.
Editor: First we write our source code with the help of Text editor Some of the editors include Windows Notepad, Notepad++, Emacs, vim or vi, etc. Editors used may vary with Operating Systems. The source files we are typically named with the extension .ts.
Node is available in this link: https://nodejs.org/en/download
TypeScript on Windows Installation:
Follow the steps given below to install Node.js in Windows environment.
Step 1 − Download and run the .msi installer for Node.
Step 2 − To verify if the installation was successful, enter the command node –v in the terminal window.
Step 3 − Type the following command in the terminal window to install TypeScript.
npm install -g typescript
type object-oriented compile language.
Typescript program is composed of −
- Statements and Expressions
var message:string = “Hello India”console.log(message)On compiling, it will
//it Generated by
var message = “Helloindia”;
- The first line declares a variable by the name message. Variables are a way to save values in a program.
- Second line prints the variable’s value to the prompt. Here, console refers to the terminal window. The function log () is used to display text on the screen.
language. Which makes our code more consistency, clean, simple and reusable. So it should better to use typescript for developing large projects.TypeScript does not support abstract classes.
TypeScript it is Static Typing useful for large Coding Projects. Better for collaboration.o When large coding projects have many developers. In that time there is a chance of messier coding. And a number of errors increases which makes the handling difficult. So Type safety has a feature to detect errors during coding time. Which makes more efficient code and also we can debug it easily. it has better productivity. Features like – dynamic typing, auto-completion are helped developer’s to boost their productivity.