Express 5
overload matches this call.
The last overload gave the following error.
Argument of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to parameter of type 'PathParams'.ts(2769)
index.d.ts(157, 5): The last overload is declared here.
app.use(compression())
Hey @zN3utr4l, can you specify which version of types you're using for Express and Compression?
{
"name": "@types/compression",
"version": "1.7.5"
}
{
"name": "@types/express-serve-static-core",
"version": "5.0.6"
}
{
"name": "@types/express",
"version": "5.0.1"
}
@zN3utr4l if you could provide a reproducible example, that would be great. Compression should work with both Express v5 and v4
I looked into the code and I think the problem is that the import express = require("express"); points to express 4.17.0 instead of 5.x.x
So I think the error is on the "@types/compression" package, which is here
But actually I have no clue how to fix this.
Playing around with the "@types/compression" dev dependency in my project fixes the issue somehow by itself after some attempts.
I do still not know the issue, but somehow it works again :/
i got same error since i got express 5 and "@types/compression": "1.7.5" this appear on : server.use(compression());
someone have a solution ? @snailcatcher i don't understand what u said about "playing around with the "@types/compression" ?
@alanbellec
- I deleted the node modules folder multiple times
- I cleaned my npm Cache multiple times
- I removed and added the package multiple times
And somehow after some time ist started, not showing the error again.