TYPESCRIPT
JavaScript with syntax for types. It adds a compile-time safety layer that catches errors before you run the code, making large-scale application development robust and predictable.
Static Analysis
In standard JS, `1 + "1"` equals `"11"`. In TypeScript, this is an error. By defining the Shape of your data upfront, the compiler ensures you never access properties that don't exist.
Interfaces
Contracts that define the structure of objects.
Generics
Reusable components that work with any data type.
Unions
Variables that can be one of several specific types.
Strict Null
Prevents the 'undefined is not an object' crash.
Interface Definition
interface User {
id: number;
username: string;
isAdmin: boolean;
}const user: User = ... Type Error
Property 'isAdmin' is missing or not boolean.
The Compilation Step
code.ts
TSC Compiler
code.js
Browsers cannot run TypeScript. It must be "transpiled" down to standard JavaScript first.