TypeScript > JavaScript
Hi, everyone I am Bijoy Kar. Thank you for reading TypeScript > JavaScript Article. Thank you to all of you for supporting me. I am quite active, I post daily on Twitter and LinkedIn so if you like then give me a follow.
Introduction
TypeScript is a programming language that is a super set of JavaScript. It was developed and is maintained by Microsoft. TypeScript adds optional static typing, class-based object-oriented programming, and other features to JavaScript. These features make it easier to write, maintain, and scale large applications.
One of the biggest advantages of TypeScript is its static typing. This means that variables, function parameters, and return types can be explicitly defined. This can help catch errors early on in the development process, before the code is even run. This can save a lot of time and effort in debugging and testing.
TypeScript also adds support for classes and interfaces, which are fundamental concepts in object-oriented programming. Classes allow for the creation of objects with specific properties and methods, and interfaces allow for the creation of a contract for objects to adhere to. These features make it easier to structure and organize code, making it more readable and maintainable.
Another advantage of TypeScript is its compatibility with existing JavaScript code. TypeScript code can be transpiled, or converted, into JavaScript, which can then be run on any platform that supports JavaScript. This means that developers can start using TypeScript in their existing JavaScript projects without having to completely rewrite the code.
TypeScript also has a robust and active community, with many open-source libraries and frameworks available. This includes popular libraries such as React, Angular, and Vue.js, which have official TypeScript support. This means that developers can use TypeScript with these libraries and frameworks, taking advantage of its features while still using the tools they are familiar with.
Overall, TypeScript is a powerful programming language that can make development easier, more efficient, and more scalable. Its static typing and object-oriented programming features can help catch errors early on and make code more readable and maintainable. Its compatibility with existing JavaScript code and active community make it a great choice for developers.
Advantages
Getting Started with TypeScript
Prerequisites
Recommended by LinkedIn
Getting Started
npm install :
npm install -g typescript
yarn install :
yarn global add typescript
For example :
function getSum(first: number, second: number)
return first + second;
}
console.log(getSum(10, 11));
console.log(getSum(13, 31));
console.log(getSum(10.44, 115.11));{
tsc index.ts
node index.js
Thank you for reading this article, if like to read more of my article then subscribe my newsletter Weekly Coding Dose and give a follow. I post daily on LinkedIn and Twitter.