Skip to content

Commit

Permalink
[apollo-server-koa] use exported bodyParser.Options type instead of i…
Browse files Browse the repository at this point in the history
…nferred type (#1334)
  • Loading branch information
chentsulin authored and evans committed Jul 11, 2018
1 parent 54a8fac commit 299018f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/apollo-server-koa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@types/accepts": "^1.3.5",
"@types/cors": "^2.8.4",
"@types/koa": "^2.0.46",
"@types/koa-bodyparser": "^4.2.0",
"@types/koa-bodyparser": "^5.0.1",
"@types/koa-compose": "^3.2.2",
"@types/koa__cors": "^2.2.1",
"accepts": "^1.3.5",
Expand Down
8 changes: 1 addition & 7 deletions packages/apollo-server-koa/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,11 @@ import { processRequest as processFileUploads } from 'apollo-upload-server';
export { GraphQLOptions, GraphQLExtension } from 'apollo-server-core';
import { GraphQLOptions, FileUploadOptions } from 'apollo-server-core';

// koa-bodyparser does not expose an Options interface so we infer the type here.
// we can replace this when this PR get merged: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/27047
export type BodyParserOptions = typeof bodyParser extends (opts: infer U) => any
? U
: never;

export interface ServerRegistration {
app: Koa;
path?: string;
cors?: corsMiddleware.Options | boolean;
bodyParserConfig?: BodyParserOptions | boolean;
bodyParserConfig?: bodyParser.Options | boolean;
onHealthCheck?: (ctx: Koa.Context) => Promise<any>;
disableHealthCheck?: boolean;
gui?: boolean;
Expand Down

0 comments on commit 299018f

Please sign in to comment.