UNPKG

989 BTypeScriptView Raw
1import * as React from 'react';
2import { DefaultRootState, StoreProp, GetProps, Matching, ConnectedComponent } from './types';
3export interface ConnectOptions {
4 /**
5 * If true, use React's forwardRef to expose a ref of the wrapped component
6 *
7 * @default false
8 */
9 forwardRef?: boolean;
10}
11/**
12* Infers the type of props that a connector will inject into a component.
13*/
14export interface ConnectProps {
15 miniStoreForwardedRef: React.Ref<any>;
16}
17export interface ConnectedState<TStateProps = {}, Store = {}, TOwnProps = {}> {
18 subscribed: TStateProps;
19 store: Store;
20 props: TOwnProps;
21}
22export declare function connect<TStateProps = {}, TOwnProps = {}, State = DefaultRootState>(mapStateToProps?: (state: State, ownProps: TOwnProps) => TStateProps, options?: ConnectOptions): <C extends React.ComponentType<Matching<TStateProps & StoreProp<State>, GetProps<C>>>>(WrappedComponent: C) => ConnectedComponent<C, TStateProps & StoreProp<State>, TOwnProps>;