バージョン0.8.0-beta.0
では、 RestLink
実装が壊れています。 私はこのチュートリアルに従い
// 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,
});
次のTypeScriptエラーが発生します。
Type 'RestLink' is missing the following properties from type 'ApolloLink': split, concat
詳細:
{
"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"
}
]
}
この動作は、 apollo-link-rest
依存関係を0.8.0-beta.0
アップグレードすることにより、コードサンドボックスの例で再現できます。
v0.7.3
戻すと、問題が解決します。
ありがとう@ lextas—ベータ版はApollo-client 3.0(および互換性のあるバージョンの関連するApolloパッケージ)での使用のみを目的としています。
残念ながら、世界的な出来事のために、Apollo-client 3.0は遅れており、彼らがいつ出荷する予定かは現在わかりません。
桶、知らなかった。 ドキュメントをフォローしました。 問題を解決します。 同じ問題に遭遇した他の人のためにこれを文書化しておくのは良いことです。 多くの人が最新バージョンをnpm install
(またはyarn
)しているだけで、機能しないため、おそらくより多くの人に起こります。
うーん、それで私はどのバージョンを使うべきですか? このためのセットアップガイドに従ったところ、この問題が発生しています。
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link": "^1.2.14",
"apollo-link-rest": "^0.8.0-beta.0",
@ Andrew1431--他のパッケージのこれらのバージョンでは、 "apollo-link-rest": "^0.7.0"
最も参考になるコメント
桶、知らなかった。 ドキュメントをフォローしました。 問題を解決します。 同じ問題に遭遇した他の人のためにこれを文書化しておくのは良いことです。 多くの人が最新バージョンを
npm install
(またはyarn
)しているだけで、機能しないため、おそらくより多くの人に起こります。