Javatpoint Logo
Javatpoint Logo

Features of TypeScript

Features of TypeScript

Object-Oriented language: TypeScript provides a powerful feature of an object-oriented language such as classes, interfaces, inheritance, modules, etc. In this, we can write code for both client-side as well as server-side development.

TypeScript supports JavaScript libraries: The developers can use existing JavaScript code with the TypeScript. It can use all of the JavaScript frameworks, tools, and other libraries.

JavaScript is TypeScript: It means the code written in JavaScript with valid .js extension can be converted to TypeScript by changing the extension from .js to .ts and compiled with other TypeScript files.

TypeScript is portable: TypeScript is portable because it can be run on any browsers, devices or any operating systems. It can be run in any environment where JavaScript runs on. It is not specific to any virtual-machine for execution.

DOM Manipulation: TypeScript can be used to manipulate the DOM for adding or removing elements similar as of JavaScript.

TypeScript is just a JavaScript: TypeScript code is not understandable by any browsers directly. TypeScript code starts with JavaScript and ends with JavaScript. Hence, we only need to know JavaScript to use it in TypeScript. The code is written in TypeScript is compiled and converted into its JavaScript equivalent for the execution. The above process is known as Trans-piled. With the help of JavaScript code, browsers are able to read the code and display the output.

Advantage of TypeScript over JavaScript

  • TypeScript always highlights errors at compilation time during the time of development whereas JavaScript points out errors at the runtime.
  • TypeScript supports strongly typed or static typing whereas this is not in JavaScript.
  • TypeScript runs on any browser or JavaScript engine.
  • Great tooling supports with IntelliSense which provides active hints as the code is added.
  • It has a namespace concept by defining a module.

Disadvantage of TypeScript over JavaScript

  • TypeScript takes a long time to compile the code.
  • TypeScript does not support abstract classes.
  • If we run the TypeScript application in the browser, a compilation step is required to transform TypeScript into JavaScript.

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA