TypeScript Interview Master
Curated 25+ essential TypeScript questions covering interfaces, type guards, generics, utility types, and advanced mapped types.
Difficulty Filters
Tools & Options
What is TypeScript, and how is it different from JavaScript?
TypeScript is a strongly-typed, open-source programming language developed by Microsoft that acts as a strict syntactical superset of JavaScript. Unlike JavaScript, TypeScript checks code structures at compile-time and outputs standard JavaScript files, providing features like type safety, interfaces, static typing, and IDE auto-completion.
Explain the difference between `interface` and `type` alias.
Both interfaces and type aliases can define shapes of objects. However, `interface` is open-ended and supports declaration merging (defining same interface multiple times appends fields), and can be extended with `extends`. A `type` alias is closed, can represent primitive unions, intersections, and tuples, but cannot be re-declared to merge properties.
// Interface declaration merging
interface User { name: string; }
interface User { age: number; } // Now User has both name & age
// Type union
type Status = 'active' | 'inactive';What are generics in TypeScript?
Generics allow developers to create reusable components, functions, or classes that work with multiple types rather than a single typed definition. They allow users to pass the type argument dynamically while maintaining type safety.
function identity<T>(arg: T): T {
return arg;
}
let output1 = identity<string>("hello");
let output2 = identity<number>(100);What is the difference between `any` and `unknown` types?
What are union and intersection types?
What is Type Narrowing / Type Guards?
How do you define a custom type guard in TypeScript?
What does the `keyof` operator do?
What are utility types? List some common ones.
Explain the `Pick` and `Omit` utility types.
What is the difference between `never` and `void`?
What is an enum in TypeScript, and how is it used?
What is a Tuple type?
What is type assertion, and how does it differ from type casting?
What is the non-null assertion operator?
What is the `readonly` modifier in TypeScript?
Explain index signatures in TypeScript.
What are conditional types in TypeScript?
Explain the `infer` keyword in conditional types.
What are mapped types in TypeScript?
Explain template literal types.
What is structural typing in TypeScript?
What is strict mode in TypeScript?
How do you type React components and events in TypeScript?
How do you declare types for external non-TypeScript JavaScript libraries?
Technical Interview Mastery Blueprint
Proven methodologies and frameworks to succeed in technical and architecture rounds.
1. The Engineering STAR Technique
When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.
2. Defending Architectural Trade-Offs
Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.
3. Clean Code & Edge-Case Proactivity
In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.
4. Antipatterns to Avoid
Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.
Explore Related Tools
Hand-picked utilities and calculators related to this tool.
