A brief understanding of Typescript.

TypeScript is an open-source, object-oriented language developed and maintained by Microsoft, licensed under Apache 2 license.expoundsofttechsolution

TypeScript extends JavaScript by adding data types, classes, and other object-oriented features with type-checking. It is a typed superset of JavaScript that compiles to plain JavaScript.


TypeScript is JavaScript for application-scale development.Javascript has evolved a lot in the last few years. We are now able to write object-oriented JS code, with ES6 But there is also another way with additional features: Typescript.

Features of TypeScript:

  • TypeScript is just JavaScript: TypeScript starts with JavaScript and ends with JavaScript. Typescript adopts the basic building blocks of your program from JavaScript. Hence, you only need to know JavaScript to use TypeScript. All TypeScript code is converted into its JavaScript equivalent for the purpose of execution.
  • Cross-Platform: TypeScript runs on any platform that JavaScript runs on. The TypeScript compiler can be installed on any Operating System such as Windows, macOS, and Linux.
  • JavaScript is TypeScript: This means that any valid .js file can be renamed to .ts and compiled with other TypeScript files
    TypeScript supports other JS libraries: Compiled TypeScript can be consumed from any JavaScript code. TypeScript-generated JavaScript can reuse all of the existing JavaScript frameworks, tools, and libraries.
  • Static type-checking: TypeScript uses static typing. This is done using type annotations. It helps type checking at compile time. Thus, you can find errors while typing the code without running your script each time. Additionally, using the type inference mechanism, if a variable is declared without a type, it will be inferred based on its value.

Why use TypeScript?

JavaScript is a dynamic programming language with no type of system. JavaScript provides primitive types like string, number, object, etc., but it doesn’t check assigned values. JavaScript variables are declared using the var keyword, and it can point to any value. JavaScript doesn’t support classes and other object-oriented features. So, without the type system, it is not easy to use JavaScript to build complex applications with large teams working on the same code.

The type system increases the code quality, readability and makes it easy to maintain and refactor the codebase. More importantly, errors can be caught at compile time rather than at runtime.

Hence, the reason to use TypeScript is that it catches errors at compile-time so that you can fix them before you run code. It supports object-oriented programming features like data types, classes, enums, etc., allowing JavaScript to be used at scale.

TypeScript compiles into simple JavaScript. The TypeScript compiler is also implemented in TypeScript and can be used with any browser or JavaScript engines like Node.js. TypeScript needs an ECMAScript 3 or higher compatible environment to compile. This is a condition met by all browsers and JavaScript engines today.>a-brief-understanding-of-typescript

Some of the most popular JavaScript frameworks like Angular.js and WinJS are written in TypeScript.>a-brief-understanding-of-typescript

So, thanks for following this blog, and if you need any help please leave your queries in the comment box we will be happy to help you.>a-brief-understanding-of-typescript