JS Guide
HomeQuestionsSearchResources
Search

Built for developers preparing for JavaScript, React & TypeScript interviews.

ResourcesQuestionsSupport
HomeQuestionsSearchProgress
HomeQuestionstypescript

typescript

TypeScript types, generics, and advanced type programming

Your Progress

0 of 5 completed

0%

5 Questions

junior Level
1
What is TypeScript and what benefits does it provide over JavaScript?
junior
basics
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It adds optional static typing, interfaces, and other features that help catch errors at compile time, improve IDE support, and make code more maintainable.
2
What are the basic types in TypeScript?
junior
types
TypeScript includes primitive types (string, number, boolean, null, undefined, symbol, bigint), array types, tuple types, object types, and special types like any, unknown, void, and never.
3
What is the difference between interfaces and type aliases in TypeScript?
junior
interfaces
Both define object shapes, but interfaces can be extended and merged (declaration merging), while type aliases can represent unions, tuples, and primitives. Use interfaces for objects/classes and type aliases for unions or complex types.
4
What are union and intersection types in TypeScript?
junior
unions
Union types (A | B) represent values that can be one of several types - use when a value could be different types. Intersection types (A & B) combine multiple types into one - use when a value must satisfy all types simultaneously.
5
How do you type functions in TypeScript?
junior
functions
Functions can be typed by annotating parameters and return type. TypeScript infers return types when possible. Use function type expressions for callbacks, optional/default parameters for flexibility, and overloads for multiple signatures.