diff --git a/packages/apollo-client/CHANGELOG.md b/packages/apollo-client/CHANGELOG.md index ab025392213..2be77dd9dd8 100644 --- a/packages/apollo-client/CHANGELOG.md +++ b/packages/apollo-client/CHANGELOG.md @@ -1,6 +1,7 @@ # Change log ### vNext +- Define and expose `ApolloClientOptions`, Type of an object that represents ApolloClient's constructor argument. ### 2.0.0-rc.3 - Only include `data` on subscriptionData when using `subscribeToMore` diff --git a/packages/apollo-client/src/ApolloClient.ts b/packages/apollo-client/src/ApolloClient.ts index 0ddc3b764af..f3072ffab4c 100644 --- a/packages/apollo-client/src/ApolloClient.ts +++ b/packages/apollo-client/src/ApolloClient.ts @@ -29,6 +29,16 @@ export interface DefaultOptions { let hasSuggestedDevtools = false; +export type ApolloClientOptions = { + link: ApolloLink; + cache: ApolloCache; + ssrMode?: boolean; + ssrForceFetchDelay?: number; + connectToDevTools?: boolean; + queryDeduplication?: boolean; + defaultOptions?: DefaultOptions; +}; + /** * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries * and mutations) to a GraphQL spec-compliant server over a {@link NetworkInterface} instance, @@ -70,15 +80,7 @@ export default class ApolloClient implements DataProxy { * @param fragmentMatcher A function to use for matching fragment conditions in GraphQL documents */ - constructor(options: { - link: ApolloLink; - cache: ApolloCache; - ssrMode?: boolean; - ssrForceFetchDelay?: number; - connectToDevTools?: boolean; - queryDeduplication?: boolean; - defaultOptions?: DefaultOptions; - }) { + constructor(options: ApolloClientOptions) { const { link, cache, diff --git a/packages/apollo-client/src/index.ts b/packages/apollo-client/src/index.ts index 2f2590721f3..5569a854992 100644 --- a/packages/apollo-client/src/index.ts +++ b/packages/apollo-client/src/index.ts @@ -19,7 +19,9 @@ export * from './core/types'; export { ApolloError } from './errors/ApolloError'; -import ApolloClient from './ApolloClient'; +import ApolloClient, { ApolloClientOptions } from './ApolloClient'; + +export { ApolloClientOptions }; // export the client as both default and named export { ApolloClient };