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 'TokenRefreshLink' is missing the following properties from type 'ApolloLink': onError, setOnError ts(2739) #20

Closed
miller-productions opened this issue May 15, 2020 · 10 comments

Comments

@miller-productions
Copy link

miller-productions commented May 15, 2020

Hi there,

Just wondering if anyone has encountered this issue.

When trying to use TokenRefreshLink, I get the following error when building up the link property..

Type 'TokenRefreshLink' is missing the following properties from type 'ApolloLink': onError, setOnError ts(2739)
const refreshTokenLink = new TokenRefreshLink({
// etc... <omitted here for brevity>
// set proper values for 
accessTokenField:
isTokenValidOrUndefined:
fetchAccessToken:
handleFetch:
handleError:

I also build up a basic set of other links

Then...

// compose the links in sequence 
const link = from([refreshTokenLink, errorLink, authLink, httpLink]);
                              ^^^
                          error occurs here

Using the following

"apollo-link-token-refresh": "^0.2.7",
"@apollo/client": "^3.0.0-beta.44",
"@apollo/link-context": "^2.0.0-beta.3",
"@apollo/link-error": "^2.0.0-beta.3",

I have found the following similar type of issue over here and also here.

I have tried the following:

  • downgrading to an older version of "@apollo/client": "^3.0.0-beta.37". (didn't solve it)
  • upgrading to a newer version "@apollo/client": "^3.0.0-beta.48", (made it worse, got additional errors)
  • casting (new TokenRefreshLink({ etc as unknown) as ApolloLink
@maryschmidt
Copy link

I'm getting the same type error instantiating a new client using apollo-boost. Tried the same steps to resolve to no avail.

@alexbarksdale
Copy link

@miller-productions @maryschmidt A temporary solution that I'm using is just simply casting the new TokenRefreshLink({....}) as any.

Example:

....
new TokenRefreshLink({
    accessTokenField: '....',
    isTokenValidOrUndefined: () => {....},
    fetchAccessToken: () => {....},
    handleFetch: (accessToken) => {....},
    handleError: (err) => {....},
}) as any,
....

@miller-productions
Copy link
Author

Issue appears to be resolved following #18

I can confirm that I am no longer seeing the issue with

"@apollo/client": "^3.0.0-beta.48",
"apollo-link-token-refresh": "^0.3.1",

@miller-productions
Copy link
Author

Reports in the wild this is still occurring using @apollo/client version 'rc-0'.

Is anyone seeing this?

@chrisjaimes
Copy link

Types of property 'split' are incompatible.

"apollo-client": "^2.6.10",
 "apollo-link-token-refresh": "^0.3.1",

Fails here at refreshLink
link: from([authMiddleware, logoutLink, refreshLink, http]),

@newsiberian
Copy link
Owner

@chrisjaimes , version 0.3.x is only compatible w/ apollo 3

@onpaws
Copy link

onpaws commented Jun 8, 2020

Reports in the wild this is still occurring using @apollo/client version 'rc-0'.

Is anyone seeing this?

I was able to resolve this by carefully ensuring everything in package.json about Apollo was at v3, removing yarn.lock, and reinstalling. This is rc2.
Stubborn one. Hope this helps!

@chrisjaimes
Copy link

@newsiberian thanks, I just downgraded to 0.2.5 but I'm still getting the following error:

Type 'TokenRefreshLink<string>' is missing the following properties from type 'ApolloLink': split, concat

unless... I do as any

@eDubrovsky
Copy link

Reports in the wild this is still occurring using @apollo/client version 'rc-0'.

Is anyone seeing this?

Confirm this error with @apollo/client version 3.0.rc-2

@miller-productions
Copy link
Author

Closing this - confirmed it is no longer an issue in the latest versions of apollo-link-token-refresh and @apollo/client.

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

7 participants