From ffb95adb2717d637da0459705cae7b5411df7667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Bruus=20Frank?= Date: Wed, 19 Dec 2018 15:19:28 +0100 Subject: [PATCH] Added context to connectAdvanced options. --- types/react-redux/index.d.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 8ff3352ecb..914505b2a9 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -389,13 +389,21 @@ export interface ConnectOptions { * @default false */ withRef?: boolean; + /** + * The react context to get the store from. + * + * @default ReactReduxContext + */ + context?: Context; } -export interface ReactReduxContextType { +export interface ReactReduxContextObject { store: Store; storeState: SS; } +export type ReactReduxContextType = Context> + export interface ProviderProps { /** * The single Redux store in your application. @@ -403,7 +411,8 @@ export interface ProviderProps { store: Store; /** * Optional context to be used internally in react-redux. Use React.createContext() to create a context to be used. - * Initial value doesn't matter, as it is overwritten with the internal state of Provider. + * If this is used, generate own connect HOC by using connectAdvanced, supplying the same context provided to the + * Provider. Initial value doesn't matter, as it is overwritten with the internal state of Provider. */ context?: Context; } @@ -426,4 +435,4 @@ export function createProvider(storeKey: string): typeof Provider; * Exposes the internal context used in react-redux. It is generally advised to use the connect HOC to connect to the * redux store instead of this approeach. */ -export const ReactReduxContext: Context; +export const ReactReduxContext: ReactReduxContextType;