In this article, we are learn TypeScript.
What is TypeScript:
- TypeScript is a modern age Javascript development language.
- It is a statically compiled language to write clear and simple Javascript code.
- Typescript provides optional static typing, classes, and interface.
- Typescript is a modern age Javascript development language.
- It can be run on Node js or any browser which supports ECMAScript 3 or newer versions.
- TypeScript is a programming language developed and maintained by Microsoft.
- As TypeScript is a superset of JavaScript, existing JavaScript programs are also valid TypeScript programs.
- TypeScriptis an open-source pure object-oriented programing language.
- It is not directly run on the browser. It needs a compiler to compile and generate in JavaScript file.
- Typescript source file is in ".ts" extension. We can use any valid ".js" file by renaming it to ".ts" file.
- TypeScript is the ES6 version of JavaScript with some additional features.
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.
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.
JavaScript vs Typescript:
- JavaScript is a scripting language which helps you create interactive web pages whereas Typescript is a superset of JavaScript.
- Typescript code needs to be compiled while JavaScript code doesn’t need to compile.
- Typescript supports a feature of prototyping while JavaScript doesn't support this feature.
- Typescript Uses concepts like types and interfaces to describe data being used whereas JavaScript has no such concept.
- Typescript is a powerful type system, including generics & JS features for large size project whereas JavaScript is an ideal option for small size project.
Why Typescript?
- TypeScript supports JS libraries & API Documentation.
- It is a superset of Javascript.
- It is optionally typed scripting language.
- TypeScript Code can be converted into plain JavaScript Code.
- Better code structuring and object-oriented programming techniques.
- Allows better development time tool support.
What is better?
In the end, we can say that if an experienced developer is working on relatively small coding projects, then JavaScript is ideal. However, if you have knowledge and expertise development team, then Typescript is a most preferred option.
Thank you.....
No comments:
Post a Comment