You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
React app using apollo-boost version 0.3.1 depends on apollo-client version ^2.5.1 fails to compile with typescript version 3.4.5 with error, notable react-apollo is also locked to version 2.5.2 as any newer version fails to pass client through HOC's: Type '"cache-and-network"' is not assignable to type '"cache-first" | "network-only" | "cache-only" | "no-cache" | "standby" | undefined'. TS2322
This is with a fresh package-lock.json, cleared node_modules and npm cache cleared followed by an npm install
Actual outcome:
React app using apollo-boost version 0.3.1 depends on apollo-client version ^2.5.1 fails to compile with typescript version 3.4.5 with error: Type '"cache-and-network"' is not assignable to type '"cache-first" | "network-only" | "cache-only" | "no-cache" | "standby" | undefined'. TS2322
This is with a fresh package-lock.json, cleared node_modules and npm cache cleared followed by an npm install
apollo-client version 2.6.0 is installed and the App fails to run with the error described above.
this appears to be some change in apollo-client/core/watchQueryOptions.ts from version 2.5.1: export declare type FetchPolicy = 'cache-first' | 'cache-and-network' | 'network-only' | 'cache-only' | 'no-cache' | 'standby';
changed to in version 2.6.0: export type FetchPolicy = 'cache-first' | 'network-only' | 'cache-only' | 'no-cache' | 'standby'; export type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';
How to reproduce the issue:
create a react app with typescript version 3.4.5 and apollo-boost 0.3.1 or apollo-client 2.6.0 and use a query component with the fetch policy "cache-and-network"
The FetchPolicy type has been split into two types, so that passing cache-and-network to ApolloClient#query is now forbidden at the type level, whereas previously it was forbidden by a runtime invariant assertion:
Note: it's important to use react-apollo@2.5.6 together with apollo-client@2.6.0. Not sure if it's a typo that your apollo-client version is still 2.5.1?
Intended outcome:
React app using apollo-boost version 0.3.1 depends on apollo-client version ^2.5.1 fails to compile with typescript version 3.4.5 with error, notable react-apollo is also locked to version 2.5.2 as any newer version fails to pass client through HOC's:
Type '"cache-and-network"' is not assignable to type '"cache-first" | "network-only" | "cache-only" | "no-cache" | "standby" | undefined'. TS2322
<Query query={query} variables={var} fetchPolicy={"cache-and-network"}>
This is with a fresh package-lock.json, cleared node_modules and npm cache cleared followed by an npm install
Actual outcome:
React app using apollo-boost version 0.3.1 depends on apollo-client version ^2.5.1 fails to compile with typescript version 3.4.5 with error:
Type '"cache-and-network"' is not assignable to type '"cache-first" | "network-only" | "cache-only" | "no-cache" | "standby" | undefined'. TS2322
<Query query={query} variables={var} fetchPolicy={"cache-and-network"}>
This is with a fresh package-lock.json, cleared node_modules and npm cache cleared followed by an npm install
apollo-client version 2.6.0 is installed and the App fails to run with the error described above.
this appears to be some change in apollo-client/core/watchQueryOptions.ts from version 2.5.1:
export declare type FetchPolicy = 'cache-first' | 'cache-and-network' | 'network-only' | 'cache-only' | 'no-cache' | 'standby';
changed to in version 2.6.0:
export type FetchPolicy = 'cache-first' | 'network-only' | 'cache-only' | 'no-cache' | 'standby'; export type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';
How to reproduce the issue:
create a react app with typescript version 3.4.5 and apollo-boost 0.3.1 or apollo-client 2.6.0 and use a query component with the fetch policy "cache-and-network"
Versions
System:
OS: Windows 10
Binaries:
Node: 8.11.3 - C:\Program Files\nodejs\node.EXE
npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
apollo-boost: ^0.3.1 => 0.3.1
apollo-client: 2.5.1 => 2.5.1
react-apollo: 2.5.2 => 2.5.6
The text was updated successfully, but these errors were encountered: