Type 'TokenRefreshLink' is missing the following properties from type 'ApolloLink': onError, setOnError ts(2739)
See original GitHub issueHi 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({
etcas unknown) as ApolloLink
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:10 (1 by maintainers)
Top Results From Across the Web
ApolloClient Type errors for ApolloLink - Stack Overflow
Answer to my own post: import { ApolloClient, ApolloProvider, InMemoryCache, split } from '@apollo/client'; import { setContext } from ...
Read more >Error Link - Apollo GraphQL Docs
Options. The function you provide the onError link is passed an object with the following fields: Name / Type ...
Read more >apollo-link-token-refresh - npm
Token Refresh Link npm version. Purpose. An Apollo Link that performs renew expired JWT (access tokens). Installation.
Read more >Type error - Missing 200+ properties : r/typescript - Reddit
12 votes, 14 comments. Type error: Type '{ children: Element; className: string; closeButton: true; }' is missing the following properties ...
Read more >apollo-link-token-refresh - npm package - Snyk
The Token Refresh Link does not use the context for anything. apollo-link-token-refresh development dependencies. @apollo/client@types/graphql@types/jest@ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@miller-productions @maryschmidt A temporary solution that I’m using is just simply casting the
new TokenRefreshLink({....})
asany
.Example:
Closing this - confirmed it is no longer an issue in the latest versions of apollo-link-token-refresh and @apollo/client.