All question banksWeb Development
TypeScript Questions A focused collection of the most critical TypeScript interview questions covering type system internals, advanced types, and best practices for modern development.
1. What is TypeScript and why use it over JavaScript? Beginner 2. What is the difference between any, unknown, and never types? Intermediate 3. What is the difference between interface and type alias? Intermediate 4. What are union types and intersection types? Beginner 5. What is type inference in TypeScript? Beginner 6. What is type assertion? (as vs <> syntax) Intermediate 7. What is the difference between null and undefined? Beginner 8. What are generics? Why are they useful? Advanced 9. What is tsconfig.json and its important options? Intermediate 10. What is strictNullChecks? Intermediate 11. What are optional chaining (?.) and nullish coalescing (??)? Beginner 12. What is the readonly modifier? Beginner 13. What are literal types? Intermediate 14. What is type narrowing and type guards? Intermediate 15. What is the keyof operator? Advanced 16. How do you define optional and default parameters? Beginner 17. What is function overloading in TypeScript? Intermediate 18. What are rest parameters with TypeScript? Beginner 19. How do you type arrow functions? Beginner 20. What is the this parameter type? Advanced 21. How do you create generic functions? Intermediate 22. What is ReturnType<T> utility type? Advanced 23. What are optional properties in interfaces? Beginner 24. What is interface declaration merging? Intermediate 25. What are index signatures? Intermediate 26. What are access modifiers: public, private, protected? Beginner 27. What is the difference between private and #private? Advanced 28. What are abstract classes and methods? Intermediate 29. What is the difference between extends and implements? Beginner 30. What are parameter properties in classes? Intermediate 31. What are static members? Beginner 32. What are getters and setters? Intermediate 33. What are utility types? (Partial, Required, Pick, Omit, Record) Intermediate 34. What is Partial<T> and when to use it? Intermediate 35. What is Pick<T, K> and Omit<T, K>? Intermediate 36. What are mapped types? Advanced 37. What are conditional types? Advanced 38. What is the infer keyword? Advanced 39. What are discriminated unions (tagged unions)? Advanced 40. What are custom type guards using is keyword? Intermediate 41. What is as const assertion? Intermediate 42. What are tuple types? Beginner 43. What are enums? Difference between numeric and string enums? Beginner 44. What are const enums? Intermediate 45. What is the difference between modules and namespaces? Intermediate 46. What are declaration files (.d.ts)? Intermediate 47. What is the declare keyword? Advanced 48. How do you add TypeScript to an existing JavaScript project? Intermediate 49. How do you handle external JavaScript libraries without types? Intermediate 50. What are common TypeScript errors and how to fix them? Intermediate