Function parameter types are contravariant, so even though Request is a subtype of RouteRequest, Request => Response is not a subtype of RouteRequest => RouteResponse (or RouteCallback).
A type can be contravariant when it does call methods on the type that it is generic over.
If the type needs to return values of the type it is generic over, it cannot be contravariant.
A type can be contravariant when it does call methods on the type that it is generic over.
If the type needs to return values of the type it is generic over, it cannot be contravariant.
Functions are the best example of contravariance
(note that they’re only contravariant on their arguments, and they’re actually covariant on their result).