Skip to content

Commit

Permalink
fastify: Switch req type to ServerResponse rather than `OutgoingM…
Browse files Browse the repository at this point in the history
…essage`.

While currently we use `OutgoingMessage`, it actually seems to be suggested
that `ServerResonse` — which is an extension of `OutgoingMessage`:

https://github.com/fastify/fastify/blob/master/docs/TypeScript.md#example

Helps-to-land: #2844
  • Loading branch information
abernix committed Jul 30, 2019
1 parent 9f01d9c commit 7638f64
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/apollo-server-fastify/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
processFileUploads,
} from 'apollo-server-core';
import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
import { IncomingMessage, OutgoingMessage, Server } from 'http';
import { IncomingMessage, ServerResponse, Server } from 'http';
import { graphqlFastify } from './fastifyApollo';
import { GraphQLOperation } from 'graphql-upload';

Expand Down Expand Up @@ -36,7 +36,7 @@ const fileUploadMiddleware = (
server: ApolloServerBase,
) => (
req: FastifyRequest<IncomingMessage>,
reply: FastifyReply<OutgoingMessage>,
reply: FastifyReply<ServerResponse>,
done: (err: Error | null, body?: any) => void,
) => {
if (
Expand Down Expand Up @@ -80,7 +80,7 @@ export class ApolloServer extends ApolloServerBase {
const promiseWillStart = this.willStart();

return async (
app: FastifyInstance<Server, IncomingMessage, OutgoingMessage>,
app: FastifyInstance<Server, IncomingMessage, ServerResponse>,
) => {
await promiseWillStart;

Expand Down Expand Up @@ -121,7 +121,7 @@ export class ApolloServer extends ApolloServerBase {
const beforeHandlers = [
(
req: FastifyRequest<IncomingMessage>,
reply: FastifyReply<OutgoingMessage>,
reply: FastifyReply<ServerResponse>,
done: () => void,
) => {
// Note: if you enable playground in production and expect to be able to see your
Expand Down

0 comments on commit 7638f64

Please sign in to comment.