Function with subtype argument doesn’t cast to a function with a base type argument
I’m trying to implement a middleware for Koa that slightly extends type of state on context, but the extended state doesn’t cast successfully to the base state if I try to cast function that uses extended state to a function that uses base state. I’ve spent 3 hours already figuring out what is wrong, but I still don’t understand.