Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed imports in apollo-server-express #2521

Closed
wants to merge 1 commit into from

Conversation

kss943
Copy link

@kss943 kss943 commented Apr 1, 2019

In my project i had these two mistakes:

node_modules/apollo-server-express/dist/ApolloServer.d.ts:1:9 - error TS1192: Module '"..../node_modules/@types/express/inde
x"' has no default export.

1 import  express from 'express';
          ~~~~~~~
node_modules/apollo-server-express/dist/ApolloServer.d.ts:2:9 - error TS1192: Module '"..../node_modules/@types/cors/index"'
 has no default export.

2 import  corsMiddleware from 'cors';

So i change it. Maybe this request will be useful.

@apollo-cla
Copy link

@kss943: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@martijnwalraven
Copy link
Contributor

You should make sure esModuleInterop is set to true in your tsconfig.json, that will solve this issue.

@abernix
Copy link
Member

abernix commented Apr 4, 2019

Thanks for taking the time to investigate a fix.

As @martijnwalraven mentioned above, this can be resolved by setting esModuleInterop: true in the TypeScript compilerOptions for the app. This flag became available in TypeScript 2.7 and helps align TypeScript with the behavior chosen by Babel, Webpack, Rollup, React Native, etc.

You might also be able to avoid the type errors by enabling allowSyntheticDefaultImports, but we're not planning on switching back to the less-declarative import * pattern.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants