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

Fix typescript issue with defaultOptions in constructor #3585

Merged
merged 2 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Export the `QueryOptions` interface, to make sure it can be used by other
projects (like `apollo-angular`).
- Fixed an issue caused by typescript changes to the constructor
`defaultOptions` param, that prevented `query` defaults from passing type
checks.
([@hwillson](https://github.com/hwillson) in [#3585](https://github.com/apollographql/apollo-client/pull/3585))

### Apollo Boost (0.1.9)

Expand Down
5 changes: 5 additions & 0 deletions packages/apollo-client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

- Export the `QueryOptions` interface, to make sure it can be used by other
projects (like `apollo-angular`).
- Fixed an issue caused by typescript changes to the constructor
`defaultOptions` param, that prevented `query` defaults from passing type
checks.
[Issue #3583](https://github.com/apollographql/apollo-client/issues/3583)
[PR #3585](https://github.com/apollographql/apollo-client/pull/3585)

### 2.3.3

Expand Down
5 changes: 3 additions & 2 deletions packages/apollo-client/src/ApolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ObservableQuery } from './core/ObservableQuery';
import { Observable } from './util/Observable';

import {
QueryBaseOptions,
QueryOptions,
WatchQueryOptions,
SubscriptionOptions,
Expand All @@ -34,7 +35,7 @@ import { version } from './version';

export interface DefaultOptions {
watchQuery?: ModifiableWatchQueryOptions;
query?: QueryOptions;
query?: QueryBaseOptions;
mutate?: MutationBaseOptions;
}

Expand Down Expand Up @@ -246,7 +247,7 @@ export default class ApolloClient<TCacheShape> implements DataProxy {
// XXX Overwriting options is probably not the best way to do this long
// term...
if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {
options = { ...options, fetchPolicy: 'cache-first' } as WatchQueryOptions;
options = { ...options, fetchPolicy: 'cache-first' } as QueryOptions;
}

return this.queryManager.query<T>(options);
Expand Down
1 change: 1 addition & 0 deletions packages/apollo-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
ApolloCurrentResult,
} from './core/ObservableQuery';
export {
QueryBaseOptions,
QueryOptions,
WatchQueryOptions,
MutationOptions,
Expand Down