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 'RestLink' is missing the following properties from type 'ApolloLink': split, concat #255

Closed
lextas opened this issue Jun 14, 2020 · 4 comments

Comments

@lextas
Copy link

lextas commented Jun 14, 2020

On version 0.8.0-beta.0 the RestLink implementation is broken. I followed this tutorial but the first code block already breaks:

// Create a RestLink for the Github API
const link = new RestLink({ uri: 'https://api.github.com' });

// Configure the ApolloClient with the recommended cache and our RestLink
const client = new ApolloClient({
  cache: new InMemoryCache(),
  link,
}); 

results in the following TypeScript error:

Type 'RestLink' is missing the following properties from type 'ApolloLink': split, concat

details:

{
	"resource": "/*redacted*/src/file.ts",
	"owner": "typescript",
	"code": "2739",
	"severity": 8,
	"message": "Type 'RestLink' is missing the following properties from type 'ApolloLink': split, concat",
	"source": "ts",
	"startLineNumber": 11,
	"startColumn": 3,
	"endLineNumber": 11,
	"endColumn": 7,
	"relatedInformation": [
		{
			"startLineNumber": 17,
			"startColumn": 5,
			"endLineNumber": 17,
			"endColumn": 9,
			"message": "The expected type comes from property 'link' which is declared here on type 'ApolloClientOptions<NormalizedCacheObject>'",
			"resource": "/*redacted*/node_modules/apollo-client/ApolloClient.d.ts"
		}
	]
}

This behaviour is reproducable on the codesandbox example by upgrading the apollo-link-rest dependency to 0.8.0-beta.0.

Reverting back to v0.7.3 resolves the issue.

@fbartho
Copy link
Collaborator

fbartho commented Jun 14, 2020

Thanks @lextas — the beta is only intended for use with Apollo-client 3.0 (and related Apollo packages at compatible versions).

Unfortunately due to world events, Apollo-client 3.0 has been delayed, and I’m not currently aware when they plan to ship.

@lextas
Copy link
Author

lextas commented Jun 14, 2020

Oke, I didn't know that. I just followed the docs. I will close the issue. It's good to have this documented for others who run in to the same problem. It probably happens to more people since lots of people just npm install (or yarn) the latest version and it won't work.

@lextas lextas closed this as completed Jun 14, 2020
@Andrew1431
Copy link

Hmm, so what versions should I be using? I just followed the set-up guide for this and am running in to this issue.

    "apollo-cache-inmemory": "^1.6.6",
    "apollo-client": "^2.6.10",
    "apollo-link": "^1.2.14",
    "apollo-link-rest": "^0.8.0-beta.0",

@fbartho
Copy link
Collaborator

fbartho commented Jul 1, 2020

@Andrew1431 -- with those versions of the other packages, you want "apollo-link-rest": "^0.7.0"

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

3 participants