What is TypeScript? How to install TypeScript?
JavaScript is a unique programming language. It is built for web development and has different rules than other programming languages.
One of the notable differences is that JavaScript is dynamically entered, meaning that you don't have to declare types when creating variables. Languages like C, C # and Java force you to declare variable types. These are called static variables.
Languages that use static variables can provide more stability and reduce errors in code. TypeScript narrows the gap between JavaScript and traditional programming rules.
What is TypeScript?
TypeScript is a JavaScript version developed by Microsoft that introduces types of variables into code. It is not a completely new language. TypeScript has a very similar syntax to JavaScript, so it's easy to get started.
To show how similar they are, here is a line of code in both JavaScript and TypeScript.
- JavaScript:
let myNumber = 10;
- TypeScript:
let myNumber: number = 10;
When declaring a variable in TypeScript, you must also declare that variable type at the same time. This is a small change but it has a big impact.
TypeScript is a compiled language, unlike JavaScript that runs in the browser.
Although there is no additional software to download, TypeScript files are compiled into regular JavaScript files that can be used in any web application. TypeScript files are saved as .TS files .
How to install TypeScript
It's easy to get started with TypeScript:
- Through the Node.js package manager (NPM)
- Install the Visual Studio plugin of TypeScript
Installing with NPM is very easy with the command line:
> npm install -g typescript
If you use Visual Studio 2017 or Visual Studio 2015 Update 3, you already have TypeScript included. If it is not already installed, you can download it via the TypeScript website.
You should read it
- How to use Enum in TypeScript
- TypeScript optional parameters in Callbacks
- 10 programming languages booming today
- Do you know the 15 hottest programming languages on this GitHub?
- Do you know what programming language is?
- In the end, big universities realized that Java was a lousy language if used for introductory programming
- GitHub launches 'Copilot', an AI that can code with you
- Overview of R language, install R on Windows and Linux
- Test on C programming P6
- Set of multiple choice questions about programming with P10 prize
- What do you know about Smalltalk programming language?
- What do you know about programming language C # P1