Intended outcome:
Typescript doesn't complain when setting default query options without a query value
defaultOptions: {
query: {
fetchPolicy: 'no-cache'
}
}
Actual outcome:
_Property 'query' is missing in type '{ fetchPolicy: "no-cache"; }'._
Argument of type '{ link: ApolloLink; cache: InMemoryCache; defaultOptions: { query: { fetchPolicy: "no-cache"; }; ...' is not assignable to parameter of type 'ApolloClientOptions<NormalizedCacheObject>'. Types of property 'defaultOptions' are incompatible. Type '{ query: { fetchPolicy: "no-cache"; }; }' is not assignable to type 'DefaultOptions'. Types of property 'query' are incompatible. Type '{ fetchPolicy: "no-cache"; }' is not assignable to type 'QueryOptions<OperationVariables>'. Property 'query' is missing in type '{ fetchPolicy: "no-cache"; }'.
Versions
Apollo client 2.3.3 (was working in 2.3.1, haven't tested 2.3.2)
Notes
I am assuming this was an unintended change from https://github.com/apollographql/apollo-client/pull/3569?
Definitely not intentional @josh18 - thanks for letting us know! I'll have a fix deployed shortly.
apollo-client
2.3.4 was just released, and includes a fix for this. Thanks!
So fast! Thanks for your help 🙂