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

Subsequent property declarations must have the same type - cacheControl #5575

Closed
jasper-s opened this issue Aug 3, 2021 · 5 comments
Closed

Comments

@jasper-s
Copy link

jasper-s commented Aug 3, 2021

I tried updating from v2 to v3 and keep running into the following error:

node_modules/apollo-server-types/src/index.ts:303:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'cacheControl' must be of type 'ResolveInfoCacheControl', but here has type 'ResolveInfoCacheControl'.

303     cacheControl: ResolveInfoCacheControl;
        ~~~~~~~~~~~~

  node_modules/apollo-server-types/dist/index.d.ts:140:9
    140         cacheControl: ResolveInfoCacheControl;
                ~~~~~~~~~~~~
    'cacheControl' was also declared here.

It seems to be related to this change.

Originally posted by @jasper-s in #5512 (comment)

@glasser
Copy link
Member

glasser commented Aug 3, 2021

It seems like for some reason your TypeScript configuration is set up to load some files from node_modules/apollo-server-types/src and some from node_modules/apollo-server-types/dist: ie, both the original TS source and the generated .d.ts for the same package. This seems like a problem with your TS configuration.

If you can share a complete reproduction that allows me to see the exact error on my machine without any creativity, I'm happy to reopen and take a look.

@glasser glasser closed this as completed Aug 3, 2021
@jasper-s
Copy link
Author

jasper-s commented Aug 4, 2021

Thank you for the response. I've been trying to figure out why that would be, and will continue that. Let me give some more information:

I have a dependency on apollo-server-lambda, and a devDependency on apollo-server.
This error does not occur in versions 3.0.0 and 3.0.1, IF I also add apollo-server-core and apollo-server-types with the respective version to my dependencies. If I do not add them, the error also occurs with 3.0.0 and 3.0.1.

So perhaps something is wrong after all that has nothing to do with my project configuration?

@awarrenlove
Copy link

I encountered this issue as well, and after spending too much time searching online and debugging by building up a completely new service piece-by-piece, I finally discovered that my IDE had auto-imported import { GraphQLRequest } from 'apollo-server-types/src/index'; in one of my classes. Simply importing from apollo-server-types fixed my issue, as I just didn't pay enough attention to the original autocomplete.

@jneate
Copy link

jneate commented Aug 24, 2021

Upgrading the following dependencies resolved the issue for me:

  • apollo-server-core 3.1.2 -> 3.2.0
  • apollo-server-types 3.1.1 -> 3.2.0

@samthomson
Copy link

I encountered this after upgrading apollo-server to 3.4.1 from 3.
First I tried upgrading apollo-server-core to the same version, but that didn't work. Then updating both to 3.5 did work.

"apollo-server": "3.5",
"apollo-server-core": "3.5",

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants