Other Companies (Name Not Shared) React.js Interview Questions for 5-8 years
Shared question set for 5-8 years of experience, TypeScript. Topics and wording follow the supplied notes; these are questions, not official company guidance.
- What is the difference between type and interface in TypeScript? When would you choose one over the other? Can an interface be extended or merged?
- What is the difference between any, unknown, never and void? When is each appropriate, and why should any generally be avoided?
- What are generics in TypeScript? How would you use them to create reusable functions, components, API clients or utility types?
- What is type narrowing? How do typeof, instanceof, in, equality checks and custom type guards help TypeScript determine the actual type?
- What are union and intersection types? Explain type A = User | Admin versus type B = User & Admin, and when you would use each.
- What are type guards, and how would you create a custom type guard (for example, to tell a success response from an error response)?
- What are TypeScript utility types? Explain practical use cases for Partial, Required, Pick, Omit, Record, Readonly and ReturnType.
- How would you type an API response in a real-world application (generic responses, pagination, errors, optional fields, different response shapes)?
- What is the difference between TypeScript compile-time types and runtime validation? If TypeScript says an API response is User, does that guarantee the runtime data is a User?
- How would you design a strongly typed large-scale TypeScript application (strict mode, shared types, domain models, API contracts, generics, avoiding any, type-safe error handling)?