Closed bradenmitchell closed 2 years ago
May I ask where should the sessionStore
comes from / provide? Can't see it in connect-mongo
, so it should be coming from express-session
?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm submitting a ... [X] bug report [ ] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project
Summary I am not sure if this issue is related to
connect-mongo
itself orexpress-session
more broadly. When using Typescript and trying to access the session store on the request object, VS Code displays the error:Property 'sessionStore' does not exist on type 'Request<{}, any, any, ParsedQs, Record<string, any>>'
This error is displayed both when explicitly typing
req
asexpress.Request
and when allowing express to implicitly type it. However, if explicitly typing asreq: any
, the error is not displayed and the sessionStore acts as expected.For example: The following code has the type error
app.get('/sessions', ( req: Request, res: Response ) => { req.sessionStore.all(( err, sessions ) => { res.json( sessions )} ) }
whereas the code below does not have the type error
app.get('/sessions', ( req: any, res: Response ) => { req.sessionStore.all(( err, sessions ) => { res.json( sessions )} ) }
Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)