Closed AviVahl closed 2 years ago
Hi thanks for your report.
Those types provide a better developer experience in your IDE with autocompletion; Also in non-typescript projects.
With @types/express
you'll get autocompletion of express' req
and res
objects, which was broken as reported here: https://github.com/chimurai/http-proxy-middleware/issues/692
Perhaps the yarn warning can suppressed by marking as optional:
"peerDependenciesMeta": {
"@types/express": {
"optional": true
}
},
https://docs.npmjs.com/cli/v7/configuring-npm/package-json#peerdependenciesmeta
Marking a peer dependency as optional ensures npm will not emit a warning if the @types/express package is not installed on the host. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed.
I have to double check if this will solve the issue.
Specifying the peerDependenciesMeta
field would indeed solve the warning, AFAIK.
We are utilizing "http-proxy-middleware" (and "express") in a custom package which is meant to be used by other packages. It only provides a command in its package.json ("bin") which can be executed (no "js" / "typescript" coding involved).
Since the last change we now get the warning for every usage of our custom package. Does it really make sense to require adding "@types/express" to every usage of our package to resolve the warning? Seems contra intuitive to me. We could add "@types/express" to the normal dependencies of our custom package to avoid the warning but this feels weird as types are usually added as "devDependency"...
In addition to this I think it is not the job of "http-proxy-middleware" to enforce / require adding "@types/express". If it is anyones job "express" should do that (but I wouldn't encourage that either)...
Can you please revert this change?
fixed in v2.0.3
Checks
http-proxy-middleware
.Describe the bug (be clear and concise)
Latest version requires
@types/express
as a peerDependency, printing warnings for non-typescript projects as well.Step-by-step reproduction instructions
Expected behavior (be clear and concise)
No warnings when installing package. Don't require users to install
@types
packages as if everyone is using typescript.How is http-proxy-middleware used in your project?
What http-proxy-middleware configuration are you using?
What OS/version and node/version are you seeing the problem?
Additional context (optional)
Regressed by https://github.com/chimurai/http-proxy-middleware/pull/700