What does TypeScript offer?
- Class based objects - Another huge advantage is the use of Classes which provides the ability to use true object oriented programming in our applications and prevents use of prototype based objects. It also provides encapsulation, inheritance and modifiers.
- Modularity — It helps make the code more modular.
- ES6 Features — Support for ES6 features is also one of the main reasons for its popularity.
- Syntax — TypeScript provides syntax which is closer to java and other high level languages (Syntactical Sugaring).
TypeScript Compiler (tsc)
- Written in TypeScript itself.
- Compiles .ts files to .js files.
- Installed as an NPM package (NodeJS).
- Supports ES6 syntax.
- TypeScript - It is an Object Oriented Language (Class based)
- Statically Typed language
- Supports Modules
- Provides Errors at Compile time / during development
- Takes more time as the code needs to be Compiled
- Dynamically Typed language
- Does not Support Modules
- Doesn’t provide Compile time errors
- No need of compilation
Why is TypeScript is gaining popularity?
Why do we use TypeScript ?
- Code quality — Defining Data Structures in the beginning, using types and interfaces, forces you to think about your app’s data structure from the start and make better design decisions.
- Prevents bugs — TypeScript won’t make your software bug free. But it can prevent a lot of type-related errors. Along with the Clever IntelliSense many browsers and IDEs support direct debugging through Source Maps .
- Active community — TypeScript is getting more and more popular. It’s used by the top tech companies like Google, Airbnb, Shopify, Asana, Adobe, and Mozilla so we can assume that it reaches their expectations in terms of scalability — as they are developing large and complex applications.
After Saving the above files we need to transpile the TypeScript Code.
In the terminal, type the following command:
tsc types.js (syntax : tsc filename).
So, in this article we’ve learnt about TypesScript why should you use typescript, what is TypeScript and etc. I hope you found some help from this article. Share this article with anybody you think would benefit from this. If you have any suggestions, feel free to hit me up. I hope you enjoyed this article. If you did, make sure to let me know in the comments down below and don’t hesitate to buy me a coffee by clicking below👇!
(PAPA Team Writer)
It is an Object Oriented Language (Class based)It is an Object Based Language (Prototype based)Statically Typed languageDynamically Typed languageSupports ModulesDoes not Support ModulesProvides Errors at Compile time / during developmentDoesn’t provide Compile time errorsTakes more time as the code needs to be CompiledNo need of compilation
Why is TypeScript gaining popularity ?