You don't have to write every type
TypeScript is clever: when you write let count = 0, it already knows count is a number. This is type inference. Good TypeScript writes types where they help and lets inference do the rest.
The primitive types
let city = "Pokhara"; let altitude = 822; let open = true; altitude = altitude + 10; city = 42; const greeting = "Namaste";
- string, number, boolean — the everyday primitives.
- null and undefined — "nothing here" (TypeScript tracks these carefully in strict mode).
- Annotate function parameters (TypeScript can't guess those) and anything declared without a value: let total: number;