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

infer keyword

What is the purpose of the infer keyword in conditional types?

Answer options

  • Forces type checking at runtime
  • Automatically assigns a type to a variable
  • Converts a type to its string representation
  • Allows extracting (inferring) a type within the extends condition

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