Advanced
TypeScript
Q81 / 100
What is the difference between covariance and contravariance in TypeScript function parameter typing?
Correct! Well done.
Incorrect.
The correct answer is B) By default (without strictFunctionTypes for method syntax), function parameters are checked bivariantly, while strictFunctionTypes enforces contravariant checking for function-typed variables
B
Correct Answer
By default (without strictFunctionTypes for method syntax), function parameters are checked bivariantly, while strictFunctionTypes enforces contravariant checking for function-typed variables
Explanation
TypeScript normally checks function parameters bivariantly for methods, but the strictFunctionTypes flag enforces sound contravariant checking for function type variables (not methods).
Progress
81/100