Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

(fix) - correct Context types for useContext #3018

Merged
merged 7 commits into from
May 28, 2019
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
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- Make sure `MockedProvider` is using the proper CJS/ESM bundle, when
referencing `ApolloProvider`. <br/>
[@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. <br/>
[@JoviDeCroock](https://github.com/JoviDeCroock) in [#3018](https://github.com/apollographql/react-apollo/pull/3018)

### Bug Fixes

Expand Down
5 changes: 2 additions & 3 deletions src/ApolloContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ export interface ApolloContextValue {
operations?: Map<string, { query: DocumentNode; variables: any }>;
}

export const ApolloContext = React.createContext
? React.createContext<ApolloContextValue | undefined>(undefined)
: null;
export const ApolloContext = React.createContext &&
React.createContext<ApolloContextValue | undefined>(undefined)