What does ‘contra-variance’ mean for function parameter types in TypeScript?

TypeScript Associate Hard

TypeScript Associate — Hard

What does ‘contra-variance’ mean for function parameter types in TypeScript?

Key points

  • Contravariance allows assigning functions with supertype parameters to variables with subtype parameter types.
  • This concept is specific to function parameter types in TypeScript.
  • It is important to understand contravariance to ensure type safety in TypeScript code.

Ready to go further?

Related questions