What is the result of `type T = string extends string | number ? ‘yes’ : ‘no’`?

TypeScript Professional Hard

TypeScript Professional — Hard

What is the result of `type T = string extends string | number ? ‘yes’ : ‘no’`?

Key points

  • The ternary operator checks if the left operand is a subset of the right operand
  • 'string' is a subset of 'string | number'
  • This results in the condition being true and 'yes' being assigned to T

Ready to go further?

Related questions