Member-only story
Learn TypeScript Basics in this Beginner’s Guide
3 min readAug 3, 2024
What is TypeScript
- It is a programming language built and maintained by Microsoft
- It is a superset of JavaScript that adds strong type checking and is compiled into plain JavaScript code. Being a superset means that TypeScript has all the features of JavaScript as well as some additional features. JavaScript is a loosely typed language so it can be difficult to understand what types of data are being passed around in JavaScript.
- TypeScript (TS) adds static typing with optional type annotations to JavaScript. Static type checking is the process of verifying the type safety of a program based on analysis of a program’s text.
- It is designed for the development of large applications and transpiles to JavaScript.
- The TypeScript compiler is itself written in TypeScript and compiled to JavaScript.
Main Features of TypeScript
- Type Annotations: Type annotation means assigning a type to a variable or a function
const birthdayGreater = (name: string, age: number): string => {
return `Happy Birthday ${name}, you are now ${age} years old!`;
};
const birthdayHero = "Jane Doe";
const age = 22;
console.log(birthdayGreeter(birthdayHero, age));