TypeScript Types Demystified: Simple Types, Special Types, and Type Inference

In the first post, we covered why TypeScript exists and how to write your first program. Now it's time to get comfortable with the type system itself — the foundation everything else is built on.

By the end of this post, you'll know how to type variables, arrays, and function parameters correctly. You'll also understand the "special" types that trip up most beginners: any, unknown, never, and void.

The Core Primitive Types

TypeScript's basic types map directly to JavaScript's primitives: