wrapMapToProps.d.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. import type { ActionCreatorsMapObject, Dispatch, ActionCreator } from 'redux';
  2. import type { FixTypeLater } from '../types';
  3. declare type AnyState = {
  4. [key: string]: any;
  5. };
  6. declare type StateOrDispatch<S extends AnyState = AnyState> = S | Dispatch;
  7. declare type AnyProps = {
  8. [key: string]: any;
  9. };
  10. export declare type MapToProps<P extends AnyProps = AnyProps> = {
  11. (stateOrDispatch: StateOrDispatch, ownProps?: P): FixTypeLater;
  12. dependsOnOwnProps?: boolean;
  13. };
  14. export declare function wrapMapToPropsConstant(getConstant: (dispatch: Dispatch) => {
  15. dispatch?: Dispatch;
  16. dependsOnOwnProps?: boolean;
  17. } | ActionCreatorsMapObject | ActionCreator<any>): (dispatch: Dispatch) => {
  18. (): ActionCreatorsMapObject<any> | ActionCreator<any> | {
  19. dispatch?: Dispatch<import("redux").AnyAction> | undefined;
  20. dependsOnOwnProps?: boolean | undefined;
  21. };
  22. dependsOnOwnProps: boolean;
  23. };
  24. export declare function getDependsOnOwnProps(mapToProps: MapToProps): boolean;
  25. export declare function wrapMapToPropsFunc<P extends AnyProps = AnyProps>(mapToProps: MapToProps, methodName: string): (dispatch: Dispatch, { displayName }: {
  26. displayName: string;
  27. }) => {
  28. (stateOrDispatch: StateOrDispatch, ownProps?: P | undefined): MapToProps;
  29. dependsOnOwnProps: boolean;
  30. mapToProps(stateOrDispatch: StateOrDispatch, ownProps?: P | undefined): MapToProps;
  31. };
  32. export {};