Skip to content

Commit

Permalink
Fix: Remove incorrect cors option type from apollo-server-express's c…
Browse files Browse the repository at this point in the history
…onstructor (#2373)

* Fix: Remove incorrect cors option type from apollo-server-express's constructor

#2330 (comment)

* update changelog

* Update CHANGELOG.md
  • Loading branch information
cheapsteak authored and abernix committed Feb 25, 2019
1 parent 85470d0 commit 1ef592a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### vNEXT

- Fix `ApolloServerExpressConfig` typing incorrectly including `cors` as part of its constructor options. [PR #2373](https://github.com/apollographql/apollo-server/pull/2373)

### v2.4.6

- Allow Node.js-like runtimes to identify as Node.js as well. [PR #2357](https://github.com/apollographql/apollo-server/pull/2357) [Issue #2356](https://github.com/apollographql/apollo-server/issue/2356)
Expand Down
3 changes: 1 addition & 2 deletions packages/apollo-server-express/src/ApolloServer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import express from 'express';
import corsMiddleware, { CorsOptions } from 'cors';
import corsMiddleware from 'cors';
import { json, OptionsJson } from 'body-parser';
import {
renderPlaygroundPage,
Expand Down Expand Up @@ -76,7 +76,6 @@ export interface ExpressContext {
}

export interface ApolloServerExpressConfig extends Config {
cors?: CorsOptions | boolean;
context?: ContextFunction<ExpressContext, Context> | Context;
}

Expand Down
6 changes: 5 additions & 1 deletion packages/apollo-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export class ApolloServer extends ApolloServerBase {
private httpServer?: http.Server;
private cors?: CorsOptions | boolean;

constructor(config: ApolloServerExpressConfig) {
constructor(
config: ApolloServerExpressConfig & {
cors?: CorsOptions | boolean;
},
) {
super(config);
this.cors = config && config.cors;
}
Expand Down

0 comments on commit 1ef592a

Please sign in to comment.