Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Namespace 'Express' has no exported member 'SessionData'

I'm trying to build a typeScript project but it has an error and I do not know where it comes from and nothing has changed since last time.


node_modules/connect-mongo/src/types.d.ts:113:66 - error TS2694: Namespace 'Express' has no exported member 'SessionData'.

113         get: (sid: string, callback: (err: any, session: Express.SessionData | null) => void) => void;
                                                                     ~~~~~~~~~~~

node_modules/connect-mongo/src/types.d.ts:114:45 - error TS2694: Namespace 'Express' has no exported member 'SessionData'.

114         set: (sid: string, session: Express.SessionData, callback?: (err: any) => void) => void;
                                                ~~~~~~~~~~~

node_modules/connect-mongo/src/types.d.ts:118:47 - error TS2694: Namespace 'Express' has no exported member 'SessionData'.

118         touch: (sid: string, session: Express.SessionData, callback?: (err: any) => void) => void;
                                                  ~~~~~~~~~~~

src/controllers/http/auth/auth.ts:16:44 - error TS2339: Property 'user' does not exist on type 'Session & Partial<SessionData>'.

16             if (req.session && req.session.user) {
                                              ~~~~

src/controllers/http/auth/auth.ts:41:29 - error TS2339: Property 'user' does not exist on type 'Session & Partial<SessionData>'.

41                 req.session.user = user;
                               ~~~~

The place where the typescript gives an error

express-session this is how it is imported

like image 887
Reza Razani Avatar asked Nov 15 '20 13:11

Reza Razani


1 Answers

I reverted back to this version to fix the issue: "@types/express-session": "1.15.16",

like image 168
Matt Knight Avatar answered Nov 05 '22 03:11

Matt Knight