Skip to content
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

Merged
merged 3 commits into from
May 12, 2021

Conversation

leonardobazico
Copy link
Contributor

@leonardobazico leonardobazico commented May 12, 2021

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

@coveralls
Copy link

coveralls commented May 12, 2021

Coverage Status

Coverage remained the same at 84.953% when pulling 6e0e157 on leonardobazico:types into 3115dae on chimurai:master.

@chimurai
Copy link
Owner

Thanks for the PR.

Could you add some description and motivation for this change?

@leonardobazico
Copy link
Contributor Author

@chimurai done. Sorry for missed that

@chimurai chimurai merged commit c935888 into chimurai:master May 12, 2021
@chimurai
Copy link
Owner

Thanks for the improvement!

@leonardobazico leonardobazico deleted the types branch May 14, 2021 22:46
@leonardobazico
Copy link
Contributor Author

Thank you @chimurai

@chimurai
Copy link
Owner

chimurai commented Jul 1, 2021

published in v2.0.1 (bit late)

Thanks for the contribution!

@FDiskas
Copy link

FDiskas commented Oct 26, 2021

Now I got the error:

Property 'query' does not exist on type 'IncomingMessage'.

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,
Copy link

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants