Demo mode — data resets on refresh.
Types and Interfaces
Basic Types
Primitive Types
TypeScript has all of JavaScript's primitive types: string, number, boolean, null, undefined, symbol, and bigint.
const name: string = "Alice"
const age: number = 30
const active: boolean = true
Arrays and Tuples
Arrays are typed as T[] or Array<T>. Tuples let you define arrays with a fixed number of elements of specific types.
const nums: number[] = [1, 2, 3]
const pair: [string, number] = ["Alice", 30]
Union and Intersection Types
Union types (|) allow a value to be one of several types. Intersection types (&) combine multiple types into one.