Skip to content

Commit

Permalink
Update ApolloServer's typeDefs types to more accurately reflect r…
Browse files Browse the repository at this point in the history
…eality.

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 apollographql#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.
  • Loading branch information
abernix committed Jun 26, 2019
1 parent 32deb9f commit 77207ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/apollo-server-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<DocumentNode>;
typeDefs?: DocumentNode | Array<DocumentNode> | string | Array<string>;
parseOptions?: GraphQLParseOptions;
resolvers?: IResolvers;
schema?: GraphQLSchema;
Expand Down

0 comments on commit 77207ff

Please sign in to comment.