Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@types/express-serve-static-core breaking my typescript builds #5488

Closed
wizhaaa opened this issue Feb 17, 2024 · 1 comment
Closed

@types/express-serve-static-core breaking my typescript builds #5488

wizhaaa opened this issue Feb 17, 2024 · 1 comment
Labels

Comments

@wizhaaa
Copy link

wizhaaa commented Feb 17, 2024

In my typescript express server application, when I try to run tsc to build & compile my typescript, I get an error:

../node_modules/@types/express-serve-static-core/index.d.ts:647:18 - error TS2430: Interface 'Response<ResBody, Locals, StatusCode>' incorrectly extends interface 'ServerResponse<IncomingMessage>'.
  Property 'req' is optional in type 'Response<ResBody, Locals, StatusCode>' but required in type 'ServerResponse<IncomingMessage>'.

647 export interface Response<
                     ~~~~~~~~

../node_modules/@types/express/index.d.ts:50:29 - error TS2694: Namespace 'serveStatic' has no exported member 'RequestHandlerConstructor'.

50     var static: serveStatic.RequestHandlerConstructor<Response>;

Looking around Google, all answers say to update dependencies - but that doesn't seem to work.

MY dependencies:

"devDependencies": {
    "@types/cors": "^2.8.6",
    "@types/express": "^4.17.21",
    "@types/express-serve-static-core": "4.17.20",
    "@types/jest": "^29.x",
    "@types/mongodb": "^3.5.4",
    "@types/mongoose": "^5.7.7",
    "@types/node": "^20.11.19",
    "@types/prettier": "<2.6.0",
    "@types/shortid": "^0.0.29",
    "@types/ws": "8.5.4",
    "express": "^4.18.2",
    "jest": "^29.x",
    "jest-circus": "^29.x",
    "nodemon": "^3.0.3",
    "ts-jest": "^29.x",
    "ts-node": "^10.9.2",
    "typescript": "^5.3.3"
  }```
@wizhaaa wizhaaa added the bug label Feb 17, 2024
@UlisesGascon
Copy link
Member

Hi @wizhaaa! We don't include direct TS support within Express, I suggest to open an issue in https://github.com/DefinitelyTyped/DefinitelyTyped as they maintain @types/express-serve-static-core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants