Question · JavaScript and TypeScript course · Module 7: Advanced TypeScript
Constraint in Generics
What is a constraint in generics in TypeScript?
Answer options
- A mechanism for automatic type casting
- extends restricts the types accepted by a generic, enforcing a specific structure
- A lock preventing the use of generics with primitive types
- A variable declaration restricted to one type
You can check the correct answer by solving this task in the CodeWorlds game.