Why Use TypeScript?
TypeScript is a superset of JavaScript that adds static typing. It helps catch errors early and improves code maintainability.
Installation
npm install typescript --save-dev
Basic Usage
Create a file with the .ts
extension and write TypeScript code:
let message: string = 'Hello, TypeScript!';
console.log(message);
Compile with:
tsc filename.ts
TypeScript prepares you for scalable and error-free JavaScript projects.