Skip to content

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

@larsivi

Description

@larsivi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions