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.
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:
Error: ⚠️
Take note this error message
"Type 'NextHandleFunction' is missing the following properties from type '(string | RegExp)[]': pop, push, concat, join, and 25 more."
Answer: 👍
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..
Voila!!!
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
Share Now
Want to get more 🔥 tips like this one?
Subscribe to get notified for our new dev tutorials