From ce333cd01e19ef70fb8e7031207cebdfbb2f085d Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Fri, 1 Mar 2019 16:50:21 -0500 Subject: [PATCH] Export Context type from types.ts instead of walkTree.ts. (#2832) When we stopped reexporting everything from walkTree.ts as part of #2533, we also stopped exporting the Context type that it uses. Moving the declaration and export of Context from walkTree.ts to types.ts restores the ability to do import { Context } from "react-apollo" which should fix #2824. --- Changelog.md | 10 +++++++++- src/types.ts | 8 ++++++-- src/walkTree.ts | 5 +---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index 879fb15967..decd6490e4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,14 @@ # Change log +## vNEXT + +### Bug Fixes + +- Export `Context` type from `types.ts` instead of `walkTree.ts`, + to reenable `import { Context } from 'react-apollo'` (which has been + broken since 2.4.0).
+ [@benjamn](https://github.com/benjamn) in [#2825](https://github.com/apollographql/react-apollo/pull/2832) + ## 2.5.1 ### Bug Fixes @@ -9,7 +18,6 @@ the created test `ApolloClient` instance.
[@hwillson](https://github.com/hwillson) in [#2825](https://github.com/apollographql/react-apollo/pull/2825) - ## 2.5.0 ### Improvements diff --git a/src/types.ts b/src/types.ts index d10c34eeaa..9cd780c815 100644 --- a/src/types.ts +++ b/src/types.ts @@ -12,6 +12,10 @@ import ApolloClient, { } from 'apollo-client'; import { MutationFn } from './Mutation'; +export interface Context { + [key: string]: any; +}; + export type OperationVariables = { [key: string]: any; }; @@ -31,7 +35,7 @@ export interface MutationOpts; client?: ApolloClient; notifyOnNetworkStatusChange?: boolean; - context?: Record; + context?: Context; onCompleted?: (data: TData) => void; onError?: (error: ApolloError) => void; fetchPolicy?: FetchPolicy; @@ -45,7 +49,7 @@ export interface QueryOpts { pollInterval?: number; client?: ApolloClient; notifyOnNetworkStatusChange?: boolean; - context?: Record; + context?: Context; partialRefetch?: boolean; } diff --git a/src/walkTree.ts b/src/walkTree.ts index 4e9071ed26..e532a295b6 100644 --- a/src/walkTree.ts +++ b/src/walkTree.ts @@ -1,8 +1,5 @@ import * as React from 'react'; - -export interface Context { - [key: string]: any; -} +import { Context } from './types'; interface PreactElement

{ attributes: P;