import { IRoute } from '@umijs/core'; import { AnyAction } from 'redux'; import React from 'react'; import { EffectsCommandMap, SubscriptionAPI } from 'dva'; import { match } from 'react-router-dom'; import { Location, LocationState, History } from 'history'; {{{ dvaHeadExport }}} export interface Action { type: T } export type Reducer = ( state: S | undefined, action: A ) => S; export type ImmerReducer = ( state: S, action: A ) => void; export type Effect = ( action: AnyAction, effects: EffectsCommandMap, ) => void; /** * @type P: Type of payload * @type C: Type of callback */ export type Dispatch =

void>(action: { type: string; payload?: P; callback?: C; [key: string]: any; }) => any; export type Subscription = (api: SubscriptionAPI, done: Function) => void | Function; export interface Loading { global: boolean; effects: { [key: string]: boolean | undefined }; models: { [key: string]: any; }; } /** * @type P: Params matched in dynamic routing */ export interface ConnectProps< P extends { [K in keyof P]?: string } = {}, S = LocationState, T = {} > { dispatch?: Dispatch; // https://github.com/umijs/umi/pull/2194 match?: match

; location: Location & { query: T }; history: History; route: IRoute; } export type RequiredConnectProps< P extends { [K in keyof P]?: string } = {}, S = LocationState, T = {} > = Required> /** * @type T: React props * @type U: match props types */ export type ConnectRC< T = {}, U = {}, S = {}, Q = {} > = React.ForwardRefRenderFunction>;