-
Notifications
You must be signed in to change notification settings - Fork 2k
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
TypeScript import issues with apollo-server-express #927
Comments
Nice fix! I agree, I wish there was better Typescript support. |
I'm not sure that I follow — shouldn't we support I'll note that I saw a version of this error myself while working on creating apollo-cache-control@0.1.0 but it resolved itself after... running |
…ngth`. This change seems necessary in order to meet the new type definitions for `res.setHeader` which mandate that the argument be a string, or an array of strings. Those type definitions were introduced via the `@types/node@9` series of typing updates provided in [0], [1], [2]. With any luck, this will fix the failures being exhibited in CircleCI tests[3] after we landed those typing updates. [0]: #907 [1]: #927 [2]: #939 [3]: https://circleci.com/gh/apollographql/apollo-server/1587
…ngth`. (#956) This change seems necessary in order to meet the new type definitions for `res.setHeader` which mandate that the argument be a string, or an array of strings. Those type definitions were introduced via the `@types/node@9` series of typing updates provided in [0], [1], [2]. With any luck, this will fix the failures being exhibited in CircleCI tests[3] after we landed those typing updates. [0]: #907 [1]: #927 [2]: #939 [3]: https://circleci.com/gh/apollographql/apollo-server/1587
I fixed it by installing the types for graphql
|
Can anyone confirm that this is still a problem for them with Apollo Server 2? While this issue has a number of up-votes, it's gone otherwise silent and it's hard to determine if this problem is still affecting users so we can prioritize accordingly. Feedback would be appreciated! |
Sounds like this has been resolved. Let us know if this is still an issue. Thanks! |
@abernix I just got this issue and fixed it using whatupdave's solution. It seems it could be easily fixable by just including @types/graphql as a dependency for the cache-control package? |
Same thing here as @AleksandarFaraj describes. Using |
This fixed my issue! Thank you so much @dsebastien! |
Installing the types as mentioned above fixes the issue. |
This is still a problem for me NEED HELP |
Here's the output of my linting
Adding |
Same problem as @kachkaev |
+1 |
Same problem as @kachkaev.Any one can help ? |
+1 same problem. |
+1 |
1 similar comment
+1 |
Thank you 🙏 |
Adding @types/graphql didn't work for me, but as found here: #669 The solution was to set "moduleResolution": "node" at tsconfig.json |
Hello! The fix for the problem is to install @type/graphql. However, I realized that the latest versions of @ types / graphql completely removed the type definitions, which became part of the graphql package.
Hope this helps. |
Neither of these worked for me 🤷♂️ |
@rob137 |
Similar to @kachkaev, I got this error when running in
Interstingly it worked fine when I ran the application from terminal, so it was only in VS Code debug mode that was causing problems. Like @kachkaev, my workaround was to add |
Received this error too and ended up with the following:
After a while of debugging, trying various types.. I ended up just adding skipLibCheck: true to my tsconfig.json file.. which seems quite wrong. My full tsconfig.json file:
|
@farukbigez |
@hwillson This is still a problem on apollo server
Can't build without |
During the build process of the app I get the following error: node_modules/apollo-server-express/node_modules/apollo-server-core/dist/plugin/index.d.ts:1:13 error TS1005: '=' expected. I have not found the fix for this yet, I've deleted node_modules folder and package-lock.json but still not working. It would be nice to have some help.... tsconfig.json
|
well, it didn't work out for me. Don't know why this is closed. |
This what i do, just cast such things as any to workaround the problem |
Hello,
Yesterday while I was trying out Apollo for the first time with express and TypeScript, I've stumbled upon the following issue when compiling using TSC:
node_modules/apollo-cache-control/lib/index.d.ts(20,16): error TS2665: Invalid module name in augmentation. Module 'graphql/type/definition' resolves to an untyped module at 'C:/dev/wks/bedeals-mvp/functions/node_modules/graphql/type/definition.js', which cannot be augmented..
At first I filed apollographql/apollo-cache-control#4 but then realized that my imports were causing the issue.
This import causes the issue with TypeScript:
import {graphiqlExpress, graphqlExpress} from "apollo-server-express";
while it works fine with this one:const {graphqlExpress, graphiqlExpress} = require('apollo-server-express');
.You may say "that's the way to import it", but the first import was added for me by IntelliJ's auto-import, which is why I found this to be disturbing. I wasted a lot of time thinking that my node_modules folder wasn't okay, that my TSC version or config was incorrect, ...
It would be nice to have better TypeScript support
The text was updated successfully, but these errors were encountered: