-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: type Fastify context properly #5743
Conversation
request?: FastifyRequest, | ||
reply?: FastifyReply, | ||
request: FastifyRequest, | ||
reply: FastifyReply, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they're not actually optional:
this.createGraphQLServerOptions(request, reply), |
@@ -103,7 +114,7 @@ export class ApolloServer extends ApolloServerBase { | |||
method: ['GET', 'POST'], | |||
url: '/', | |||
preHandler, | |||
handler: async (request: FastifyRequest, reply: FastifyReply) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already typed
This looks good. It should get a CHANGELOG.md entry mentioning the new type exports; we'll merge it once that is added, or will write it ourselves eventually. |
d77959c
to
7e8def3
Compare
Thanks @glasser! |
This way a
context
function provided tonew ApolloServer
is typed correctly.I copied this approach from the Express plugin:
apollo-server/packages/apollo-server-express/src/ApolloServer.ts
Lines 37 to 56 in 48d3ab2