Question · JavaScript and TypeScript course · Module 7: Advanced TypeScript

Generic Constraints

What does the notation <T extends { length: number }> mean in TypeScript?

Answer options

  • T is an array of a specific length
  • T inherits from a class with a length field
  • T must be a type that has a length property of type number
  • T will be automatically extended with a length field

You can check the correct answer by solving this task in the CodeWorlds game.