import { AnyAction } from 'redux'; import { EffectsCommandMap } from 'dva'; import { MenuDataItem } from '@ant-design/pro-layout'; import { RouterTypes } from 'umi'; import { GlobalModelState } from './global'; import { DefaultSettings as SettingModelState } from '../../config/defaultSettings'; import { UserModelState } from './user'; export { GlobalModelState, SettingModelState, UserModelState }; export interface Loading { global: boolean; effects: { [key: string]: boolean | undefined }; models: { global?: boolean; menu?: boolean; setting?: boolean; user?: boolean; }; } export interface ConnectState { global: GlobalModelState; loading: Loading; settings: SettingModelState; user: UserModelState; } export type Effect = ( action: AnyAction, effects: EffectsCommandMap & { select: (func: (state: ConnectState) => T) => T }, ) => 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 interface Route extends MenuDataItem { routes?: Route[]; } /** * @type T: Params matched in dynamic routing */ export interface ConnectProps extends Partial> { dispatch?: Dispatch; }