TypeScript Advanced: Types, Generics, Utility Types
TypeScript Advanced: Types, Generics, Utility Types
Up to 20 questions, shuffled on every run
Welcome to the TypeScript Advanced Quiz! Test your knowledge on advanced types, generics, utility types, and more. Each question has a hint and explanations for all options. Good luck!
Answer key and explanations20 questions
The quiz above draws 20 questions at random from these 30, so a second attempt will not be the same run. Everything in the pool is listed here.
What is an interface in TypeScript?
AnswerA syntax to define the shape of an object, including properties and methods
What is a union type?
AnswerA type allowing a variable to hold values from one of several distinct types
What is an intersection type?
AnswerA type that combines multiple existing types into one, requiring all properties
What is a generic in TypeScript?
AnswerA way to create reusable components that work with a variety of types
What is a generic constraint?
AnswerA rule using the "extends" keyword to limit the types a generic can accept
What is a conditional type?
AnswerA type that selects one of two types based on a ternary-like condition
What is a mapped type?
AnswerA way to create a new type by iterating through the keys of an existing type
What is the Partial utility type?
AnswerA utility that constructs a type with all properties of T set to optional
What is the Readonly utility type?
AnswerA utility that constructs a type with all properties of T set to readonly
What is the Pick utility type?
AnswerA utility that creates a type by selecting a specific set of keys from T
What is the Omit utility type?
AnswerA utility that creates a type by picking all properties from T and then removing K
What is the Record utility type?
AnswerA utility used to construct an object type with specific keys and a specific value type
What is the typeof operator in TypeScript?
AnswerAn operator used in a type context to extract the type of a variable or property
What is the keyof operator in TypeScript?
AnswerAn operator that produces a union of string or numeric literal keys from an object
What is the Exclude utility type?
AnswerA utility that removes types from a union that are assignable to a second type
What is the Extract utility type?
AnswerA utility that selects members of a union that are assignable to a second type
What is the NonNullable utility type?
AnswerA utility that constructs a type by excluding null and undefined from T
What is the Parameters utility type?
AnswerA utility that extracts the types of arguments from a function type as a tuple
What is the ReturnType utility type?
AnswerA utility that extracts the return type of a function type T
What is the InstanceType utility type?
AnswerA utility that extracts the instance type from a constructor function type
What is the infer keyword in TypeScript?
AnswerA keyword used within a conditional type to declare a type variable to be extracted
What is a template literal type?
AnswerA type that uses template literal syntax to build new string types
What is a const assertion (as const)?
AnswerA suffix that tells the compiler to treat a literal as its most specific type
What is the satisfies operator in TypeScript?
AnswerAn operator used to validate a value matches a type while preserving its narrowest type
What are recursive types in TypeScript?
AnswerTypes that refer to themselves in their own definition to describe nested structures
What is a discriminated union?
AnswerA union of types that share a common literal property used for narrowing
What is a user-defined type guard?
AnswerA function that uses a type predicate to narrow a type within a conditional block
What is declaration merging in TypeScript?
AnswerThe ability for the compiler to join multiple declarations with the same name
What is module augmentation?
AnswerA way to add new type definitions to an existing external module
What is the Awaited utility type?
AnswerA utility that recursively unwraps a type to retrieve the non-promise result








