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

graphql-tools/linksAwaitVariablesLink doesn't have properties from ApolloLink #4897

Closed
4 tasks
vtereshyn opened this issue Dec 12, 2022 · 1 comment
Closed
4 tasks

Comments

@vtereshyn
Copy link

vtereshyn commented Dec 12, 2022

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

After upgrading to the latest version of @graphql-tools/links and moving forward with updating my app to ESM, I am getting an error that AwaitVariablesLink doesn't have concat property. I see that it extends ApolloLink:

export declare class AwaitVariablesLink extends apollo.ApolloLink {
    request(operation: apolloImport.Operation, forward: apolloImport.NextLink): apolloImport.Observable<apolloImport.FetchResult>;
}

and basically, it should have it along with ApolloLink's constructor, which is not being seen by Typescript.

To Reproduce
Steps to reproduce the behavior:

Link to codesandbox - https://codesandbox.io/s/heuristic-morning-zm76mw?file=/src/index.ts

Expected behavior

AwaitVariablesLink has properties from ApolloLink

Environment:

  • Mac OS
  • Node JS: 18.12.0
  • @graphql-tools/links - 8.3.24

UPD: This might be an issue in @apollo/client or in typings on the graphql-tools/link side. I am thinking that the way of how you're importing @apollo/client can also trigger the issue when react is missing in dependencies:

import * as apolloImport from '@apollo/client';

const apollo: typeof apolloImport = (apolloImport as any)?.default ?? apolloImport;

Apollo Client team mentioned that react won't be required if @apollo/client will be imported like suggested in commented in apollographql/apollo-client#7318

Please, LMK if I can provide more details! Thanks

@vtereshyn vtereshyn changed the title graphql-tools/links typings seem incorrect – AwaitVariablesLink doesn't have props from ApolloLink graphql-tools/links – AwaitVariablesLink doesn't have properties from ApolloLink Dec 12, 2022
@vtereshyn vtereshyn changed the title graphql-tools/links – AwaitVariablesLink doesn't have properties from ApolloLink graphql-tools/linksAwaitVariablesLink doesn't have properties from ApolloLink Dec 12, 2022
@vtereshyn
Copy link
Author

vtereshyn commented Dec 13, 2022

I guess I found what is causing the issue: if I change moduleResolution to node instead of nodenext then AwaitVariablesLink has all properties from ApolloLink but it still wants to see react in dependencies.

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

No branches or pull requests

2 participants