DEVPREP CODEX · #26
TypeScript Interview Questions
171 curated questions graded from Foundations (Easy) to Practical Patterns (Medium) and Internals & Architecture (Hard).
TOTAL QUESTIONS
171
THEORY QUESTIONS
150
IMPLEMENTATION FOLIOS
21
FREE QUESTIONS
5 / Level
Easy Level·57 Questions Total
Foundations & Core Concepts
Q1What is TypeScript? Compare it with JavaScript.
- Definition: TypeScript is a strongly typed, static superset of JavaScript developed by Microsoft. It compiles down to plain JavaScript.
- Static Typing: Checks and validates types during compilation, whereas JavaScript resolves types dynamically at runtime.
- Error Detection: Catches syntax and type-mismatch bugs in the IDE/compiler before execution.
- Tooling: Provides superior IDE support (advanced autocomplete, safe refactoring, and parameter signatures).
Q2Compare dynamic, static, and structural typing.
- Dynamic Typing (JS): Variable types are resolved at runtime. Variables can freely change types.
- Static Typing (TS): Variable types are declared and enforced during compile-time. Re-assigning an incompatible type causes a compile error.
- Structural Typing (TS): Types are compared based on their shape/structure rather than explicit nominal declarations (duck typing: "if it looks like a duck, it is a duck").
Q3Compare `any`, `unknown`, `never`, and `void` in TypeScript.
- any: Turns off all compile-time type checking. Highly unsafe; permits accessing any property or calling any method.
- unknown: Type-safe counterpart to
any. Allows holding any value, but bars any operations (property access/calls) until the type is narrowed. - void: Indicates the complete absence of a return value (typically used for functions with side effects).
- never: Represents values that will never occur (e.g., functions that throw errors or enter infinite loops).
Q4Compare Interfaces and Type Aliases.
- Declaration Merging: Interfaces can be re-declared and automatically merge properties. Type Aliases throw "duplicate identifier" errors.
- Extensibility: Interfaces extend other interfaces/types via
extends. Type Aliases compose via intersection operators (&). - Capabilities: Type Aliases can describe unions, primitives, tuples, and mapped types directly. Interfaces are strictly limited to object/class shapes.
Q5What are Type Assertions? Why can they be dangerous?
- Definition: Bypasses the compiler's automatic type inference, manually informing the compiler of a specific type (using
value as Typeor<Type>value). - Danger: Type assertions do not run runtime casting/conversions. If the runtime value does not match the asserted compile-time type, it can crash during execution with silent type mismatches.
52 More Easy Questions Locked
Unlock the complete TypeScript Easy question bank
Get instant access to all 57 questions, in-depth model answers, code sandboxes, and all 27+ technologies for a single one-time payment.
Unlock All — One-time payment · Lifetime access
Browse All TypeScript Questions by Difficulty
Easy57 Questions
Core concepts, definitions, basic syntax, and first principles expected in round 1 screening.
VIEW FULL LIST
Medium57 Questions
Real-world mechanisms, state management, edge cases, performance trade-offs, and practical coding.
VIEW FULL LIST
Hard57 Questions
Deep runtime internals, memory models, distributed design, concurrency failure modes, and architectural decisions.
VIEW FULL LIST
INTERNAL LINKING & DEPENDENCIES