-
Notifications
You must be signed in to change notification settings - Fork 853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(typescript): extract handlers types #603
Conversation
Thanks for the PR. Could you add some description and motivation for this change? |
@chimurai done. Sorry for missed that |
Thanks for the improvement! |
Thank you @chimurai |
published in Thanks for the contribution! |
Now I got the error:
pseudo code: import { createProxyMiddleware } from 'http-proxy-middleware';
export default createProxyMiddleware({
// ...
onProxyReq: (proxyReq, req, res) => {
// ...
if (req.query && req.query?.locale) { // <--- ERROR: Property 'query' does not exist on type 'IncomingMessage'.ts(2339) |
) => void; | ||
export type OnProxyResCallback = ( | ||
proxyRes: http.IncomingMessage, | ||
req: http.IncomingMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this remain Request
(express.Request
)?
I've been rewriting the handlers' types on my current project. To avoid it this PR extract handlers type and expose them
Also made the callbacks have the same types implemented on the http-proxy