Farmbot-Web-App/typings/react-redux.d.ts

66 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// Type definitions for react-redux 2.1.2
// Project: https://github.com/rackt/react-redux
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "react-redux" {
import { Component } from 'react';
import { Store, Dispatch, Action, AnyAction, ActionCreator } from 'redux';
export class ElementClass extends Component<any, any> { }
export interface ClassDecorator {
<T extends (typeof ElementClass)>(component: T): T
}
/**
* Connects a React component to a Redux store.
* @param mapStateToProps
* @param mapDispatchToProps
* @param mergeProps
* @param options
*/
export function connect(mapStateToProps?: MapStateToProps,
mapDispatchToProps?: MapDispatchToPropsFunction | MapDispatchToPropsObject,
mergeProps?: MergeProps,
options?: Options): ClassDecorator;
interface MapStateToProps {
(state: any, ownProps?: any): any;
}
interface MapDispatchToPropsFunction {
(dispatch: Dispatch<any>, ownProps?: any): any;
}
interface MapDispatchToPropsObject {
[name: string]: ActionCreator<any>;
}
interface MergeProps {
(stateProps: any, dispatchProps: any, ownProps: any): any;
}
interface Options {
/**
* If true, implements shouldComponentUpdate and shallowly compares the result of mergeProps,
* preventing unnecessary updates, assuming that the component is a “pure” component
* and does not rely on any input or state other than its props and the selected Redux stores state.
* Defaults to true.
* @default true
*/
pure: boolean;
}
export interface ProviderProps<A extends Action = AnyAction> {
/**
* The single Redux store in your application.
*/
store: Store<any, A>;
}
/**
* Makes the Redux store available to the connect() calls in the component hierarchy below.
*/
export class Provider<A extends Action = AnyAction> extends Component<ProviderProps<A>> { }
}