jaydenseric/apollo-upload-client

TS incompatibility with @apollo/client@^3.7.1 when creating ApolloLink

viktoro opened this issue · 1 comments

Everything works ok at 3.7.0 but after that the following type error occurs:

Type error: Argument of type 'ApolloLink' is not assignable to parameter of type 'ApolloLink | RequestHandler'.
  Type 'import("/usr/src/app/node_modules/@types/apollo-upload-client/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink' is not assignable to type 'import("/usr/src/app/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink'.
     Types of property 'split' are incompatible.
       Type '(test: (op: import("/usr/src/app/node_modules/@types/apollo-upload-client/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/usr/src/app/node_modules/@types/apollo-upload-client/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/usr/src/app/node_modules/@types/a...' is not assignable to type '(test: (op: import("/usr/src/app/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/usr/src/app/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/usr/src/app/node_modules/@apollo/client/link/core/types").RequestHandler, right?: import("/usr/src/app/node_modules...'.
         Types of parameters 'test' and 'test' are incompatible.
           Types of parameters 'op' and 'op' are incompatible.
             Type 'import("/usr/src/app/node_modules/@types/apollo-upload-client/node_modules/@apollo/client/link/core/types").Operation' is not assignable to type 'import("/usr/src/app/node_modules/@apollo/client/link/core/types").Operation'.
               The types returned by 'query.loc.startToken.toJSON()' are incompatible between these types.
                 Type '{ kind: TokenKind; value?: string; line: number; column: number; }' is not assignable to type '{ kind: TokenKindEnum; value: string; line: number; column: number; }'.
                   Property 'value' is optional in type '{ kind: TokenKind; value?: string; line: number; column: number; }' but required in type '{ kind: TokenKindEnum; value: string; line: number; column: number; }'.

I've tried the simple example from the docs:

import { ApolloClient } from "@apollo/client";
import { createUploadLink } from "apollo-upload-client";

const client = new ApolloClient({
  link: createUploadLink(),
});

Forgot to upgrade "@types/apollo-upload-client@^17.0.1" as well when upgrading "@apollo/client". Looks ok again with "@types/apollo-upload-client@17.0.2".