Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't modify the session (Chapter 5) #177

Closed
rohidas-gowda opened this issue May 16, 2022 · 3 comments
Closed

Can't modify the session (Chapter 5) #177

rohidas-gowda opened this issue May 16, 2022 · 3 comments
Assignees

Comments

@rohidas-gowda
Copy link

In the chapter 5, In "save session to database" section

req.session.foo = 'bar';

is giving following error

Property 'foo' does not exist on type 'Session & Partial<SessionData>' 

So I am not able to modify the sessions.
The error path:

book/5-begin/api/server/api/public.ts
@rohidas-gowda
Copy link
Author

Here is the repo I get the error:
https://github.com/rohidas-gowda/saas/blob/master/book/1-begin/api/server/api/public.ts
At line 10

@klyburke
Copy link
Member

@rohidas-gowda Thanks for reporting and sharing your code base.

I tested your code and see the problem. As a quick solution to get the code running, you can write //@ts-ignore above the line req.session.foo = 'bar';.

That worked for me, but I will look into a better solution, if it makes sense for this example in the book.

@klyburke klyburke self-assigned this May 17, 2022
@rohidas-gowda
Copy link
Author

Thanks @klyburke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants