problem Session & SessionData not import
mockingbird001 opened this issue · comments
BOM commented
How can I fix this?
This request's Session object. Even though this property isn't marked as optional, it won't exist until you use the express-session middleware Declaration merging can be used to add your own properties.
@see — SessionData
Namespace 'global.Express' has no exported member 'Session'.
req: Request & { session: Express.Session };
My code
import { EntityManager, IDatabaseDriver, Connection } from "@mikro-orm/core";
import { Request, Response } from "express";
export type MyContext = {
em: EntityManager<any> & EntityManager<IDatabaseDriver<Connection>>;
req: Request & { session: Express.Session };
res: Response;
};
I solved the problem by going back to @ 1.17.0, it helped, but there was a place for import session from 'express-session';
anyway.
Marc Harter commented
Have you tried including the @types here? https://www.npmjs.com/package/@types/express-session
Otherwise, that would be an issue with that library not this one.
BOM commented
I might be mistaken
Now I also solve \\ @ts-ignore
Thank you