TypeScript Advanced Quiz
Master decorators, conditional types, and advanced design patterns.
Start the quizSample questions from this quiz
A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.
1. What is a decorator in TypeScript?
@sealed class Greeter { }- A comment for documentation.
- A way to hide methods.
- A special kind of declaration that can be attached to classes, methods, or properties.
- A function for styling components.
Show answer
Answer: A special kind of declaration that can be attached to classes, methods, or properties.. Decorators are an experimental feature that provide a way to add annotations and meta-programming syntax for class declarations and members.
2. Which compiler option must be enabled to use decorators?
- `experimentalDecorators`
- `allowJs`
- `strict`
- `useDecorators`
Show answer
Answer: `experimentalDecorators`. To use decorators, you must enable the `experimentalDecorators` flag in your `tsconfig.json` file.
3. What is the `ReturnType<T>` utility type?
type T0 = ReturnType<() => string>;- Gets the type of the parameters of a function.
- Checks if a function returns a value.
- Returns a boolean.
- Gets the return type of a function type.
Show answer
Answer: Gets the return type of a function type.. `ReturnType<T>` constructs a type consisting of the return type of a function `T`. `T0` would be `string`.
Frequently asked questions
How many questions are in this TypeScript quiz?+
30 questions, with a 75-minute time limit. Every question includes a written explanation of the correct answer.
Is this TypeScript quiz free?+
Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.
What level is the advanced quiz aimed at?+
Master decorators, conditional types, and advanced design patterns.
Can I use this to prepare for a TypeScript interview?+
Yes. The questions cover the topics that come up in TypeScript technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.
Ready to test your TypeScript?
30 questions, 75 minutes. Free, no sign-up.
Start now