From 77207ffadef1a3cfe3fc164e9a42a3b492974efd Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Wed, 26 Jun 2019 14:28:50 +0300 Subject: [PATCH] Update `ApolloServer`'s `typeDefs` types to more accurately reflect reality. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While no TypeScript user would have ever been able to use it as such, Apollo Server has for a long time (as a side-effect of its past reliance on `graphql-tools`) accepted string types (and arrays of string types) for `typeDefs`. This hasn't been reflected in the TypeScript types, and has thus made it possible to sandbag non-TypeScript users (which let's remind ourselves, is still the majority) who were strings, when new code — like that in #2762 — didn't defend against what TypeScript indicated would be fine. Even if we don't necessarily support string types as a common pattern anymore, they still work, and we need to make sure we're coding for what we expect to work until the time comes to make a breaking change. --- packages/apollo-server-core/src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apollo-server-core/src/types.ts b/packages/apollo-server-core/src/types.ts index d0c391437da..bf11de82f62 100644 --- a/packages/apollo-server-core/src/types.ts +++ b/packages/apollo-server-core/src/types.ts @@ -68,7 +68,7 @@ type BaseConfig = Pick< // fields that are not specific to a single integration export interface Config extends BaseConfig { modules?: GraphQLSchemaModule[]; - typeDefs?: DocumentNode | Array; + typeDefs?: DocumentNode | Array | string | Array; parseOptions?: GraphQLParseOptions; resolvers?: IResolvers; schema?: GraphQLSchema;