TypeScript Overview

TypeScript Overview

TypeScript is an open-source object-oriented programming language developed and maintained by Microsoft. It’s a superset of JavaScript.

TypeScript is designed for the development of large applications and transpiles to JavaScript.

GitHub Markgithub.com/Microsoft/TypeScript

Why TypeScript?

Before learning or using any programming or scripting language you should always be aware of the need.

As we already know that TypeScript transpiles to JavaScript as browsers can only understand JavaScript.

So you might be thinking that what’s the need of adding an extra layer if the executable code is going to be JavaScript itself?

⭐There are many benefits of using TypeScript, listing down a few of them.

👉 TypeScript integrates well with React, Vue, and Angular.

👉 TypeScript is a statically typed language and this makes the code easier to refactor. Statically typed programming languages are those in which the type of a variable is known at compile-time instead of at run-time.

👉 TypeScript is easier to read and access. Helps in code maintainability.

💡 In my previous project, we were using TypeScript with React and our files were having a “.tsx” extension and not .jsx. Also, the compiler we used to transpile TypeScript code to JavaScript was Babel.

TypeScript vs JavaScript

The difference between TypeScript and JavaScript are mentioned below:

TypeScript JavaScript
Object-oriented programming language Object-based scripting language
Statically typed Dynamically typed
Has interfaces No concept of interfaces
Can declare variables with data types variables are declared with the ‘var’ keyword
File extension: .tsx or .ts File extension: .js