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

Type Error with the new Apollo client #38

Open
ImanAkrami opened this issue May 11, 2021 · 1 comment
Open

Type Error with the new Apollo client #38

ImanAkrami opened this issue May 11, 2021 · 1 comment

Comments

@ImanAkrami
Copy link

Hi, thanks for your efforts.
When i use the link in my client config, i get this eror:

Type 'TokenRefreshLink<string>' is not assignable to type 'ApolloLink | RequestHandler'.
  Type 'TokenRefreshLink<string>' is not assignable to type 'ApolloLink'.
    Types of property 'split' are incompatible.
      Type '(test: (op: import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | im...' is not assignable to type '(test: (op: import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core...'.
        Types of parameters 'left' and 'left' are incompatible.
          Type 'import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/types").RequestHandler' is not assignable to type 'import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/types").RequestHandler'.
            Type 'ApolloLink' is not assignable to type 'ApolloLink | RequestHandler'.
              Type 'import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink' is not assignable to type 'import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink'.
                Types of property 'split' are incompatible.
                  Type '(test: (op: import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core...' is not assignable to type '(test: (op: import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | im...'.
                    Types of parameters 'left' and 'left' are incompatible.
                      Type 'import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/types").RequestHandler' is not assignable to type 'import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/types").RequestHandler'.
                        Type 'ApolloLink' is not assignable to type 'ApolloLink | RequestHandler'.
                          Type 'import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink' is not assignable to type 'import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink'.
                            Types of property 'split' are incompatible.
                              Type '(test: (op: import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | im...' is not assignable to type '(test: (op: import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core...'.
                                Types of parameters 'right' and 'right' are incompatible.
                                  Type 'import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/shando/lernito-exam/frontend/node_modules/@apollo/client/link/core/types").RequestHandler | undefined' is not assignable to type 'import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/shando/lernito-exam/frontend/node_modules/apollo-link-token-refresh/node_modules/@apollo/client/link/core/types").RequestHandler | undefined'.
                                    **Type 'ApolloLink' is not assignable to type 'ApolloLink | RequestHandler | undefined'.ts(2322)**

I literally copy pasted the example in in the docs

@kevbost
Copy link

kevbost commented May 12, 2021

I know this has been discussed elsewhere, but I spent time this morning while upgrading deps trying to find a solution to this too.

Instead of patching the line with an as any, I decided to stick on the version of @apollo/client that does not throw for us: "@apollo/client": "^3.3.8",

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