DefinitelyTyped/types/mobx-apollo/index.d.ts
Nathan Shively-Sanders 2e8a04fe18
Add graphql peer dependencies (#37928)
* Add graphql peer dependencies

Apollo has a peer dependency on graphql, but several DT packages don't
install it. This fixes that.

* Bump required TS version to 2.8

* Bump version to 3.0
2019-08-27 09:07:50 -07:00

30 lines
777 B
TypeScript

// Type definitions for mobx-apollo 0.0
// Project: https://github.com/sonaye/mobx-apollo#readme
// Definitions by: Paul Selden <https://github.com/pselden>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
import {
ApolloClient,
ObservableQuery,
WatchQueryOptions,
ApolloError
} from 'apollo-client';
export interface MobxApolloQueryOptions<T> extends WatchQueryOptions {
client: ApolloClient<any>;
onFetch?: (result: T) => void;
onError?: (error: ApolloError) => void;
}
export interface MobxApolloQuery<T> {
loading: boolean;
data?: T;
error?: ApolloError;
ref: ObservableQuery<T>;
}
export default function graphql<T>(
options: MobxApolloQueryOptions<T>
): MobxApolloQuery<T>;