Question · JavaScript and TypeScript course · Module 7: Advanced TypeScript
Conditional Types
What does the conditional type T extends U ? X : Y do in TypeScript?
Answer options
- Checks at runtime if T is an instance of U
- Selects type X if T extends U, otherwise type Y
- Creates a union of types X and Y
- Throws an error if T is not compatible with U
You can check the correct answer by solving this task in the CodeWorlds game.