-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Hey! We've run into a type compatibility issue with Express 5.
Description
csrf-csrf type declarations are incompatible with projects using @types/express@5. This is because @types/express-serve-static-core@5.0.2+ removed the deprecated param(name: string, defaultValue?: any): string method from the Request interface (see DefinitelyTyped#71024), making the Request types from Express 4 and Express 5 structurally incompatible.
All versions up to 4.0.3 have @types/express@^4.17.21 in devDependencies, so the bundled .d.cts / .d.ts declarations are built against Express 4 types.
Environment
csrf-csrf: 4.0.3@types/express: 5.0.6@types/express-serve-static-core: 5.0.2+ (whereparam()was removed)express: 5.2.1- TypeScript: 5.9.3
Errors
When consuming csrf-csrf in a project with @types/express@5:
error TS2345: Argument of type 'Request' (from @types/express@5)
is not assignable to parameter of type 'Request' (from @types/express@4).
Property 'param' is missing in type 'Request' (@types/express-serve-static-core@5.0.7)
but required in type 'Request' (@types/express-serve-static-core@4.17.43).
This affects doubleCsrfProtection, generateToken, and the getTokenFromRequest callback in config options.
Question
Are there any plans to update the type declarations to support @types/express@5 / Express 5? This is also related to #67.