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

Update links package to use @apollo/client/links #2138

Merged
merged 7 commits into from
Oct 27, 2020
Merged

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented Oct 27, 2020

After Apollo Client v3 got released, apollo-link and apollo-link-http have been deprecated. So @graphql-tools/links package now uses @apollo/client/links directly as a peer dependency to prevent instanceof and typing issues.
This PR also fixes typing mismatch between observableToAsyncIterator and linkToSubscriber.
See #2111 and #2105 (comment)

@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2020

🦋 Changeset detected

Latest commit: 47e163a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@graphql-tools/links Major
@graphql-tools/utils Patch
graphql-tools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ardatan ardatan changed the title Fix links types Update links package to use @apollo/client/links Oct 27, 2020
@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 27, 2020

The latest changes of this PR are available as alpha in npm (based on the declared changesets):

@graphql-tools/batch-delegate@7.0.1-alpha-7e120d05.0
@graphql-tools/batch-execute@7.0.1-alpha-7e120d05.0
@graphql-tools/delegate@7.0.1-alpha-7e120d05.0
@graphql-tools/graphql-tag-pluck@6.2.7-alpha-7e120d05.0
graphql-tools@7.0.1-alpha-7e120d05.0
@graphql-tools/links@7.0.0-alpha-7e120d05.0
@graphql-tools/load@6.2.6-alpha-7e120d05.0
@graphql-tools/apollo-engine-loader@6.2.6-alpha-7e120d05.0
@graphql-tools/code-file-loader@6.2.6-alpha-7e120d05.0
@graphql-tools/git-loader@6.2.6-alpha-7e120d05.0
@graphql-tools/github-loader@6.2.6-alpha-7e120d05.0
@graphql-tools/graphql-file-loader@6.2.6-alpha-7e120d05.0
@graphql-tools/json-file-loader@6.2.6-alpha-7e120d05.0
@graphql-tools/module-loader@6.2.6-alpha-7e120d05.0
@graphql-tools/prisma-loader@6.2.6-alpha-7e120d05.0
@graphql-tools/url-loader@6.3.2-alpha-7e120d05.0
@graphql-tools/merge@6.2.6-alpha-7e120d05.0
@graphql-tools/mock@7.0.1-alpha-7e120d05.0
@graphql-tools/node-require@6.2.5-alpha-7e120d05.0
@graphql-tools/relay-operation-optimizer@6.2.6-alpha-7e120d05.0
@graphql-tools/resolvers-composition@6.2.6-alpha-7e120d05.0
@graphql-tools/schema@7.0.1-alpha-7e120d05.0
@graphql-tools/stitch@7.0.2-alpha-7e120d05.0
@graphql-tools/utils@7.0.1-alpha-7e120d05.0
@graphql-tools/wrap@7.0.1-alpha-7e120d05.0

@ardatan ardatan merged commit 2b6c813 into master Oct 27, 2020
@ardatan ardatan deleted the fix-links-types branch October 27, 2020 01:46
@domkm
Copy link

domkm commented Oct 27, 2020

@ardatan I'm still running into the type mismatch documented in #2111 and #2105.

Deps:

❯ yarn list --depth 0 --pattern '@apollo|@graphql-tools'
yarn list v1.22.10
├─ @apollo/client@3.2.5
├─ @apollo/protobufjs@1.0.5
├─ @apollographql/apollo-tools@0.4.8
├─ @apollographql/graphql-playground-html@1.6.26
├─ @graphql-tools/batch-delegate@7.0.0
├─ @graphql-tools/batch-execute@7.0.0
├─ @graphql-tools/code-file-loader@6.2.5
├─ @graphql-tools/delegate@7.0.1
├─ @graphql-tools/git-loader@6.2.5
├─ @graphql-tools/github-loader@6.2.5
├─ @graphql-tools/graphql-file-loader@6.2.5
├─ @graphql-tools/graphql-tag-pluck@6.2.6
├─ @graphql-tools/import@6.2.4
├─ @graphql-tools/json-file-loader@6.2.5
├─ @graphql-tools/links@7.0.0
├─ @graphql-tools/load-files@6.2.4
├─ @graphql-tools/load@6.2.5
├─ @graphql-tools/merge@6.2.5
├─ @graphql-tools/mock@7.0.0
├─ @graphql-tools/module-loader@6.2.5
├─ @graphql-tools/relay-operation-optimizer@6.2.5
├─ @graphql-tools/resolvers-composition@6.2.5
├─ @graphql-tools/schema@7.0.0
├─ @graphql-tools/stitch@7.0.1
├─ @graphql-tools/url-loader@6.3.2
├─ @graphql-tools/utils@7.0.1
└─ @graphql-tools/wrap@7.0.1

Error:

src/index.ts:154:36 - error TS2345: Argument of type '<TReturn, TArgs, TContext>({ document, variables, context, info, }: { document: DocumentNode; variables: TArgs; context: TContext; info: GraphQLResolveInfo; }) => Promise<FetchResult<TReturn, Record<string, any>, Record<...>>>' is not assignable to parameter of type 'AsyncExecutor'.
  Types of parameters '__0' and 'params' are incompatible.
    Type 'ExecutionParams<TArgs, TContext>' is not assignable to type '{ document: DocumentNode; variables: TArgs | undefined; context: TContext | undefined; info: GraphQLResolveInfo; }'.
      Property 'variables' is optional in type 'ExecutionParams<TArgs, TContext>' but required in type '{ document: DocumentNode; variables: TArgs | undefined; context: TContext | undefined; info: GraphQLResolveInfo; }'.

154     schema: await introspectSchema(executor),
                                       ~~~~~~~~
src/index.ts:155:5 - error TS2322: Type '<TReturn, TArgs, TContext>({ document, variables, context, info, }: { document: DocumentNode; variables: TArgs; context: TContext; info: GraphQLResolveInfo; }) => Promise<FetchResult<TReturn, Record<string, any>, Record<...>>>' is not assignable to type 'Executor'.
  Types of parameters '__0' and 'params' are incompatible.
    Type 'ExecutionParams<TArgs, TContext>' is not assignable to type '{ document: DocumentNode; variables: TArgs | undefined; context: TContext | undefined; info: GraphQLResolveInfo; }'.
      Property 'variables' is optional in type 'ExecutionParams<TArgs, TContext>' but required in type '{ document: DocumentNode; variables: TArgs | undefined; context: TContext | undefined; info: GraphQLResolveInfo; }'.

155     executor,
        ~~~~~~~~

  node_modules/@graphql-tools/stitch/node_modules/@graphql-tools/delegate/types.d.ts:109:5
    109     executor?: Executor;
            ~~~~~~~~
    The expected type comes from property 'executor' which is declared here on type 'SubschemaConfig<any, any, any>'

@ardatan
Copy link
Owner Author

ardatan commented Oct 27, 2020

Could you create a new issue with a minimal reproduction repo?

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

Successfully merging this pull request may close these issues.

None yet

3 participants