Question · JavaScript and React course · Module 12: React and TypeScript
Generic Constraint
What does the notation <T extends { id: number }> mean in a generic React component?
Answer options
- T inherits from a class with an id field
- T must be exactly the type { id: number }
- T must contain an id field of type number (and may have additional fields)
- T is an alias for an interface with an id field
You can check the correct answer by solving this task in the CodeWorlds game.