4

I was faced with an error of [@types/express]-Type 'P' is not assignable to type 'ParamsArray', the error was resolved by installing these specific packages "@types/express": "^4.17.8", "@types/express-serve-static-core": "^4.17.13" which throw a new error below. I have tried to downgrade "@types/express-serve-static-core" to "^4.17.5" and install qs, but none of these work.

Any suggestions on how to fix this error?

node_modules/@types/express-serve-static-core/index.d.ts:30:10 - error TS2305: Module '"../qs"' has no exported member 'ParsedQs'.

30 import { ParsedQs } from "qs";

tobslob
  • 76
  • 1
  • 3
  • 8

3 Answers3

3

It seems to be a known problem with that package (see this issue). I don't think an update for that has been released yet, but in the meantime you can use --skipLibCheck to prevent tsc from looking into packages that deeply and finding that error. This thread explains what that flag does nicely.

Zachary D.
  • 43
  • 4
  • Thank you, what I did is that I deleted all the part containing "qs" and it's types, and run `yarn` – tobslob Nov 12 '20 at 15:10
1

Here I found the solution by following the steps below:

  1. npm remove @types/express && npm add @types/express@latest
  2. delete the @types/express-serve-static-core
  3. npm update @types/express-serve-static-core --depth 1
  4. npm remove @types/express && npm i @types/express-serve-static-core@latest

Solved Problem

Thanks.

Basavaraj SK
  • 245
  • 3
  • 3
  • For me, it was enough to do `yarn remove @types/express && yarn add --dev @types/express-serve-static-core@latest @types/express`. – slhck Feb 02 '23 at 09:20
0

Just follow the following thing

npm install typescript@4.1.6

npm install -D @types/express-serve-static-core@4.17.30
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103