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

apollo-server-types: move info.cacheControl 'declare module' here #5512

Merged
merged 1 commit into from
Jul 19, 2021

Conversation

glasser
Copy link
Member

@glasser glasser commented Jul 19, 2021

This makes info.cacheControl available to TypeScript packages that
depend on apollo-server-types rather than only being declared deep
inside apollo-server-core. Additionally, it gives a name to type used
for info.cacheControl.

Intended for use cases like
apollographql/federation#870

We've run into tricky issues with declare module before so if this
ends up causing more problems than it's worth, we may revert it.

Also change some more imports to import type.

This makes `info.cacheControl` available to TypeScript packages that
depend on `apollo-server-types` rather than only being declared deep
inside `apollo-server-core`. Additionally, it gives a name to type used
for `info.cacheControl`.

Intended for use cases like
apollographql/federation#870

We've run into tricky issues with `declare module` before so if this
ends up causing more problems than it's worth, we may revert it.
@glasser glasser force-pushed the glasser/resolve-info-cache-control branch from 1d04bf5 to 539005d Compare July 19, 2021 22:00
@glasser glasser merged commit 396af01 into main Jul 19, 2021
@glasser glasser deleted the glasser/resolve-info-cache-control branch July 19, 2021 22:32
@glasser glasser added this to the MM-2021-07 milestone Jul 19, 2021
@glasser glasser added size/small Estimated to take LESS THAN A DAY 🧬 typings Relates to TypeScript changes or improvements. 🧬 cache-control Relates to cache directives, headers or packages. labels Jul 19, 2021
@hwillson hwillson removed this from the MM-2021-07 milestone Jul 29, 2021
@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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🧬 cache-control Relates to cache directives, headers or packages. size/small Estimated to take LESS THAN A DAY 🧬 typings Relates to TypeScript changes or improvements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants