From 028333e483ac725b29057e130cd34e14ce7ed37c Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Tue, 28 May 2019 19:02:57 +0200 Subject: [PATCH] (fix) - correct Context types for useContext (#3018) * fix: refactor for using useContext with TS * fix: praect does not support .createContext * chore: resolve code inconsistency * refactor: the added type can be removed * Changelog update --- Changelog.md | 3 +++ src/ApolloContext.ts | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 04db8d4aa0..edf1389144 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,9 @@ - Make sure `MockedProvider` is using the proper CJS/ESM bundle, when referencing `ApolloProvider`.
[@jure](https://github.com/jure) in [#3029](https://github.com/apollographql/react-apollo/pull/3029). +- Adjust the `ApolloContext` definition to play a bit more nicely with + `React.createContext` types.
+ [@JoviDeCroock](https://github.com/JoviDeCroock) in [#3018](https://github.com/apollographql/react-apollo/pull/3018) ### Bug Fixes diff --git a/src/ApolloContext.ts b/src/ApolloContext.ts index 6bf02b68d3..5a16a1706b 100644 --- a/src/ApolloContext.ts +++ b/src/ApolloContext.ts @@ -7,6 +7,5 @@ export interface ApolloContextValue { operations?: Map; } -export const ApolloContext = React.createContext - ? React.createContext(undefined) - : null; +export const ApolloContext = React.createContext && + React.createContext(undefined)