From 41ad16101119846c1bbdceb212e4d55b474a9f6c Mon Sep 17 00:00:00 2001 From: Binbin Date: Tue, 9 Jun 2020 09:23:29 +0900 Subject: [PATCH] Add more types to installSubscriptionHandlers --- packages/apollo-server-core/src/ApolloServer.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/apollo-server-core/src/ApolloServer.ts b/packages/apollo-server-core/src/ApolloServer.ts index 4e9bc8dfd18..8b0a4cbbb69 100644 --- a/packages/apollo-server-core/src/ApolloServer.ts +++ b/packages/apollo-server-core/src/ApolloServer.ts @@ -3,7 +3,11 @@ import { addMockFunctionsToSchema, GraphQLParseOptions, } from 'graphql-tools'; +import { Server as NetServer } from 'net' +import { Server as TlsServer } from 'tls' import { Server as HttpServer } from 'http'; +import { Http2Server, Http2SecureServer } from 'http2'; +import { Server as HttpsServer } from 'https'; import loglevel from 'loglevel'; import { execute, @@ -602,7 +606,7 @@ export class ApolloServerBase { } } - public installSubscriptionHandlers(server: HttpServer | WebSocket.Server) { + public installSubscriptionHandlers(server: HttpServer | HttpsServer | Http2Server | Http2SecureServer | WebSocket.Server) { if (!this.subscriptionServerOptions) { if (this.config.gateway) { throw Error( @@ -678,7 +682,7 @@ export class ApolloServerBase { keepAlive, validationRules: this.requestOptions.validationRules }, - server instanceof HttpServer + server instanceof NetServer || server instanceof TlsServer ? { server, path,