This content originally appeared on DEV Community and was authored by Abhishek Gupta
What is TypeScript?
TypeScript is a programming language developed by Microsoft that builds on JavaScript by adding static typing.
It allows developers to define data types within their code, helping to catch errors during development rather than at runtime. This improves code reliability and enhances developer productivity, as errors can be identified early, making the development process smoother and more predictable.
The Birth of TypeScript
JavaScript was originally created for client-side scripting in the mid-90s. However, as websites became more complex over time, developers faced issues like bugs, messy code, and lack of proper error and type checking.
To address these challenges, Microsoft created TypeScript in 2012, led by Anders Hejlsberg, to provide a more robust solution for large-scale JavaScript development.
Key Features of TypeScript
1) Static Type Checking
TypeScript allows you to check and assign types to variables, parameters, and functions.
This helps catch errors early during development and makes your code more readable and maintainable.
let name: string = "Abhishek"; // Correct
name = 123; // Error: Type 'number' is not assignable to type 'string'
This content originally appeared on DEV Community and was authored by Abhishek Gupta