Good day pare, Today while I'm doing our next tutorial regarding with our screen capture api I encountered few errors after upgrading my express and ts-node to their latest version.
If you miss out our last tutorial with regards on how i structure my node & express rest api, please check this link - A Better Structure for NodeJS & Express REST API with Typescript
While creating a new node and express template using typescript once you add a new middleware something like this below
My VS Code shown this error:
Take note this error message "Type 'NextHandleFunction' is missing the following properties from type '(string | RegExp)': pop, push, concat, join, and 25 more."
To fix this issue, I added express "RequestHandler" type assertion which means, the compiler will assume those middleware has all the type as RequestHandler.
Our new code should be like this below
And Tadaaa... it should work again..
I hope you enjoy our tutorial, Let me know incase you encounter any error I would love to answer that. Don't forget to subscribe to my Youtube Channel at Let's Code Pare - Youtube Channel