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

Extract Type

What is the purpose of the Extract<T, U> type in TypeScript?

Answer options

  • Checks if T contains type U
  • Removes from T the types compatible with U
  • Merges types T and U into one
  • Extracts from T those types that are assignable to U

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