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

Typescript issues with context from request (express, apollo-graphql) #1034

Closed
larsivi opened this issue Aug 4, 2020 · 1 comment · Fixed by #1258
Closed

Typescript issues with context from request (express, apollo-graphql) #1034

larsivi opened this issue Aug 4, 2020 · 1 comment · Fixed by #1258
Milestone

Comments

@larsivi
Copy link
Contributor

larsivi commented Aug 4, 2020

Bug report

Describe the bug

I have a setup with apollo-graphql and express, and I need to do some stuff with the context after accounts is done with it.
I used to have
"let context = await accounts.context(req);
if (context.session.body.blah == 'foo') { ... do something } ",
but now I have stricted up my typescript and I don't actually know what type context should be such that I am able to access session and body.
ModuleContext is not enough at least.

I have created my own type interface hierarchy to represent what I need from this object, but I'd prefer if I could either get this directly from the API, or at minimal from documentation.

System information

  • Version of accounts-js: [e.g. 0.0.27]

Additional context

Reposted from forum where it was suggested to fix this with generics.

@larsivi larsivi added the bug label Aug 4, 2020
@agustif
Copy link
Contributor

agustif commented Aug 4, 2020

https://www.accountsjs.com/docs/api/graphql-api/interfaces/accountsmodulecontext/

import { AccountsModuleContext } from '@accounts/graphql-api'

Not sure if this is what you need but it might help.

@darkbasic darkbasic added the 1.0 label Nov 22, 2023
@darkbasic darkbasic added this to the 1.0 milestone Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants