Closed bogomips closed 1 year ago
Describe the bug
I get a compilation error if I use the option fetchPolicy.
To Reproduce
if I have a query that looks like this
const query = { query: myQuery, variables: { id: id, date: date }, fetchPolicy: 'no-cache' } this.apollo.query(query);
I get
Types of property 'fetchPolicy' are incompatible. Type 'string' is not assignable to type 'FetchPolicy'.
Expected behavior
adding the fetchPolicy option should not generate an error
Environment:
├── @angular/cli@13.3.5 ├── @apollo/client@3.6.2 ├── apollo-angular@3.0.1 ├── graphql@15.8.0 └── typescript@4.5.5
Additional context
I temporarily solved this way:
I've copied the following line from the TS definition and added in my ts file
export declare type FetchPolicy = 'cache-first' | 'network-only' | 'cache-only' | 'no-cache' | 'standby'; // trying to fix a TS issue
Then run the query this way
const noCache:FetchPolicy = "no-cache"; //trick to fix it the TS error const query = { query: myQuery, variables: { id: id, date: date }, fetchPolicy: noCache } this.apollo.query(query);
Describe the bug
I get a compilation error if I use the option fetchPolicy.
To Reproduce
if I have a query that looks like this
I get
Expected behavior
adding the fetchPolicy option should not generate an error
Environment:
Additional context
I temporarily solved this way:
I've copied the following line from the TS definition and added in my ts file
Then run the query this way