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

Fix apollo-server-express context TypeScript definition #2349

Closed
wants to merge 3 commits into from

Conversation

KATT
Copy link
Contributor

@KATT KATT commented Feb 21, 2019

Noticed an issue when updating apollo-server-express today - my context function started breaking.

It looked something like this

interface MyContext {
  token?: string;
}
new ApolloServer({
  typeDefs,
  resolvers,
  context: (): MyContext => {
    return {
      // ...
    };
  },
});

It seem to come from #2330 which enforces the output of the ContextFunction to be the same as the first arg to the function, which I think is wrong.

This PR allows you the ContextFunction to have an incoming and an outgoing context and let's you return whatever value you want in your apollo-server-express context.


TODO:

  • Update CHANGELOG.md with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

@apollo-cla
Copy link

@KATT: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@KATT KATT changed the title Fix express context Fix apollo-server-express context TypeScript definition Feb 21, 2019
@KATT KATT force-pushed the fix-express-context branch 2 times, most recently from 550b4e6 to e944c23 Compare February 21, 2019 16:36
@KATT
Copy link
Contributor Author

KATT commented Feb 21, 2019

Alright, this was also in #2350

@KATT KATT closed this Feb 21, 2019
@KATT KATT mentioned this pull request Feb 21, 2019
4 tasks
@KATT KATT deleted the fix-express-context branch February 21, 2019 18:34
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants