TypeScript: Extend Express.Session interface with own class
问题 I'm working on a Typescript project with npm packages. I want to add a property to the Express.Session interface. example Class: class User { name: string; email: string; password: string; } export = User; New d.ts file for the interface definition (don't want to edit express-session.d.ts): declare namespace Express { interface Session { user: User } } app.ts import User = require('./User'); function (req: express.Request, res: express.Response) { req.session.user //I want to use it like this