Getting typescript error (TS2430 and TS2344): Interface 'Response<ResBody, Locals, StatusCode>' incorrectly extends interface 'ServerResponse'

Viewed 467

I am making an online storebackend API in node and express.On transpiling my (.ts) to (.js), I got this error.My project dependencies are:

"@types/express": "^4.17.12", "@types/express-serve-static-core": "^4.17.21", "@types/node": "^15.12.4", "bcrypt": "^5.0.1", "body-parser": "^1.19.0", "db-migrate": "^0.11.12", "db-migrate-pg": "^1.2.2", "dotenv": "^10.0.0", "express": "^4.17.1", "jasmine": "^3.7.0", "pg": "^8.6.0", "typescript": "^3.9.7"

"@types/bcrypt": "^5.0.0", "@types/jasmine": "^3.6.3", "@types/pg": "^7.14.11", "cross-env": "^7.0.3", "jasmine-spec-reporter": "^6.0.0", "jasmine-ts": "^0.3.0", "ts-node": "^9.1.1", "tsc-watch": "^4.2.9"

The error I am getting is:

../node_modules/@types/express-serve-static-core/index.d.ts(589,18): error TS2430: Interface 'Response<ResBody, Locals, StatusCode>' incorrectly extends interface 'ServerResponse'. Property 'req' is optional in type 'Response<ResBody, Locals, StatusCode>' but required in type 'ServerResponse'. ../node_modules/@types/express/index.d.ts(58,55): error TS2344: Type 'Response<any, Record<string, any>>' does not satisfy the constraint 'ServerResponse'. Property 'req' is optional in type 'Response<any, Record<string, any>>' but required in type 'ServerResponse'

0 Answers
Related