My magic middlewares type
If anyone wants a typescript challange here is one: I am trying to create a tuple type which contains an sequence of
MiddlewareHandler
types. This MiddlewareHandler
is defined as:
I have a function called compose
which composes these MiddlewareHandler
s. This function takes a generic array of MiddlewareHandler
:
this however does not work, as it complains when using it like following:
Plus points:
I would ideally also like the T
generic type to require that all following MiddlewareHandler
s have the its generic I
set to the previous O
like following type:
0 Replies