Skip to content

chore(typescript): extract handlers types#603

Merged
chimurai merged 3 commits intochimurai:masterfrom
leonardobazico:types
May 12, 2021
Merged

chore(typescript): extract handlers types#603
chimurai merged 3 commits intochimurai:masterfrom
leonardobazico:types

Conversation

@leonardobazico
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Owner

Thanks for the PR.

Could you add some description and motivation for this change?

@leonardobazico
Copy link
Copy Markdown
Contributor Author

@chimurai done. Sorry for missed that

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

Thanks for the improvement!

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

Thank you @chimurai

@chimurai
Copy link
Copy Markdown
Owner

chimurai commented Jul 1, 2021

published in v2.0.1 (bit late)

Thanks for the contribution!

@FDiskas
Copy link
Copy Markdown

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
Copy Markdown

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.

5 participants