Skip to content

[@types/express] error TS2694: '"...@types/express-serve-static-core/index"' has no exported member 'Params' #40905

@ttous

Description

@ttous

If you know how to fix the issue, make a pull request instead.

If you do not mention the authors the issue will be ignored.


Environment:
package.json

  • "express": "^4.17.1"
  • "@types/express": "^4.17.2"
  • "typescript": "^3.7.3"

Action to reproduce the error:

tsc

Error encountered:

node_modules/@types/express/index.d.ts(90,50): error TS2694: Namespace '"C:/Users/ttoussaint/path/to/my/project/node_modules/@types/express-serve-static-core/index"' has no exported member 'Params'.
node_modules/@types/express/index.d.ts(90,64): error TS2694: Namespace '"C:/Users/ttoussaint/path/to/my/project/node_modules/@types/express-serve-static-core/index"' has no exported member 'ParamsDictionary'.
node_modules/@types/express/index.d.ts(90,90): error TS2315: Type 'ErrorRequestHandler' is not generic.
node_modules/@types/express/index.d.ts(99,38): error TS2694: Namespace '"C:/Users/ttoussaint/path/to/my/project/node_modules/@types/express-serve-static-core/index"' has no exported member 'Params'.
node_modules/@types/express/index.d.ts(99,52): error TS2694: Namespace '"C:/Users/ttoussaint/path/to/my/project/node_modules/@types/express-serve-static-core/index"' has no exported member 'ParamsDictionary'.
node_modules/@types/express/index.d.ts(99,78): error TS2315: Type 'Request' is not generic.
node_modules/@types/express/index.d.ts(100,45): error TS2694: Namespace '"C:/Users/ttoussaint/path/to/my/project/node_modules/@types/express-serve-static-core/index"' has no exported member 'Params'.
node_modules/@types/express/index.d.ts(100,59): error TS2694: Namespace '"C:/Users/ttoussaint/path/to/my/project/node_modules/@types/express-serve-static-core/index"' has no exported member 'ParamsDictionary'.
node_modules/@types/express/index.d.ts(100,85): error TS2315: Type 'RequestHandler' is not generic.

What I tried that DID NOT work:

  • rm -rf node_modules + npm i

What I tried that DID work:
In my package-lock.json, I could see the following:

"@types/express-serve-static-core": {
   "version": "4.16.2",
   ...
},

I added @types/express-serve-static-core@latest to my project's dependencies:
package.json

"@types/express-serve-static-core": "^4.17.0"

So now the package-lock.json looks like so:

"@types/express-serve-static-core": {
   "version": "4.17.0",
   ...
},

I cannot make a PR since the package.json file is not in this repository. This is still an issue, since @types/express-serve-static-core should not appear amongst my dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions