How to Type a Middleware factory?
Lemme first show you what I want, so you can get the gist of it. (Consider me less experienced in typescript)
This is what I put together. This almost works
I get autocompletion in vscode, but when I press tab and proceed with the autocompletion, I get an error that looks like this (the screenshot attached). Feels like i'm in the right path but cant exactly make a solid type out it.
Now, for my very specific use case, i did make an workaround by making that
But this feels like a half measure. And provided that different validation libs might affect the type of input in subtle ways, I need to know how to properly type this thing.
Thank you
This is what I put together. This almost works
I get autocompletion in vscode, but when I press tab and proceed with the autocompletion, I get an error that looks like this (the screenshot attached). Feels like i'm in the right path but cant exactly make a solid type out it.
Now, for my very specific use case, i did make an workaround by making that
T generic partial But this feels like a half measure. And provided that different validation libs might affect the type of input in subtle ways, I need to know how to properly type this thing.
Thank you
