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 Lambda context function typing #5481

Merged
merged 1 commit into from
Jul 15, 2021
Merged

Commits on Jul 15, 2021

  1. Fix Lambda context function typing

    In AS3 we made apollo-server-lambda inherit from apollo-server-express,
    but didn't realize that it also inherited the more precise TS typings on
    its constructor that meant that its `context` function would take
    Express-specific parameters (rather than the default unconstrained
    parameter).
    
    This change makes it easier for any ApolloServer subclass to declare its
    context function typing, and updates apollo-server-express and
    apollo-server-lambda to do so. The other integrations are left with the
    vaguer defaults.
    
    Tests didn't catch this before because they didn't pass a `context`
    function *directly* to the Lambda ApolloServer constructor, just via a
    function with a looser signature.
    
    An earlier version of this PR attempted to add the context object type
    (ie TContext) to the ApolloServer generics as well. But it didn't
    actually connect through to the TContext on processHTTPRequest and
    trying to link those up ran into some technical issues, so I decided to
    leave it out.
    
    Fixes #5480.
    glasser committed Jul 15, 2021
    Configuration menu
    Copy the full SHA
    3310405 View commit details
    Browse the repository at this point in the history