What is TypeScript and why would we use it in place of JavaScript?


It’s never been a better time to be a JavaScript developer! JavaScript is everywhere now – it’s on the front and back-end of a website, and many desktop text editors are powered by JavaScript. In fact you can build a whole range of desktop applications using web technologies as their foundation.

TypeScript is a Superset of JavaScript.

TypeScript: Making .NET Developers Comfortable with JavaScript

“.TS” is TypeScript File Extension as similar to java script file extension “.Js”.

TypeScript is a free and open-source programming language developed and maintained by Microsoft. It is a strict superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language.TypeScript may be used to develop JavaScript applications for client-side or server-side (Node.js) execution.

TypeScript is designed for development of large applications and transcompiles to JavaScript.[7] As TypeScript is a superset of JavaScript, any existing JavaScript programs are also valid TypeScript programs.

TypeScript adds common concepts such as classes, modules, interfaces, generics and (optional) static typing to JavaScript. All JavaScript code is valid TypeScript code so it can be added seamlessly to any project. The TypeScript compiler emits JavaScript.

Installing TypeScript

There are two main ways to get the TypeScript tools:

  • Via npm (the Node.js package manager)
  • By installing TypeScript’s Visual Studio plugins

Visual Studio 2015 and Visual Studio 2013 Update 2 include TypeScript by default.

For NPM users:

Open Command prompt and execute below command.It will take some time to download and install all required assemblies.

npm install -g typescript



Now Validate the setup process by executing Tsc command on same command prompt.


Supportive tools for TypeScript:


Benefits of typescript:

  • Due to the static typing, code written in TypeScript is more predictable, and is generally easier to debug.
  • Makes it easier to organize the code base for very large and complicated apps thanks to modules, namespace and strong OOP support.
  • TypeScript has a compilation step to JavaScript that catches all kinds of errors before they reach runtime and break something.
  • The upcoming Angular 2 framework is written in TypeScript and it’s recommended that developers use the language in their projects as well.

For more details please refer https://www.typescriptlang.org/docs/tutorial.html

TypeScript PlayGround:

Type Script Playground is online tool for developing and testing typescript programs without installing any external tools.It automatically translate type script to java script.




Some important features of TypeScript:

  1. TypeScript Code is Converted into Plain JavaScript Code
  2. Data Types
  3. Classes
  4. Access Modifiers and Properties
  5. Static and Instance Members
  6. Function Overloading
  7. Constructors
  8. Inheritance
  9. Interfaces
  10. Modules
  11. Type Annotation
  12. Generics
  13. Type inference
  14. Tuple
  15. Await

Since TypeScript generates plain JavaScript code you can use it with any browser. Overall TypeScript is a promising language  that can certainly help you neatly write and organize your JavaScript code base making it more maintainable and extensible.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s