What are the basic types in TypeScript?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid TypeScript basics — a prerequisite for any developer role.

Answer

TypeScript has several built-in primitive types: number (all numeric values — integers and floats), string (text), boolean (true/false), null (intentional absence), undefined (uninitialized value), symbol (unique identifiers), and bigint (large integers). Additionally: any (opt out of type checking — avoid using it), unknown (safe alternative to any — forces type narrowing before use), never (a function that never returns — throws or infinite loops), void (function returns nothing useful), object (non-primitive type). Complex types include Array<T> or T[], tuple (fixed-length arrays with specific types), enum (named constants), and object/interface types. Literal types let you constrain a value to a specific set: type Direction = "north" | "south" | "east" | "west".

Common Mistake

A common mistake is memorizing definitions without understanding implications. When asked this question, go one level deeper — explain what happens when this concept is misused or ignored.