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

Generic Interface

How do you define a generic interface in TypeScript?

Answer options

  • interface Container { value: <T>; }
  • interface Container<T> { value: T; getValue(): T; }
  • interface<T> Container { value: T; }
  • generic interface Container(T) { value: T; }

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