import { EffectsCommandMap } from 'dva'; import { AnyAction } from 'redux'; import { RouterTypes } from 'umi'; import { GlobalModelState } from './global'; import { MenuModelState } from './menu'; import { UserModelState } from './user'; import { DefaultSettings as SettingModelState } from '../../config/defaultSettings'; import { MenuDataItem } from '@ant-design/pro-layout'; export { GlobalModelState, MenuModelState, SettingModelState, 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 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; menu: MenuModelState; user: UserModelState; } export interface Route extends MenuDataItem { routes?: Route[]; } /** * @type T: Params matched in dynamic routing */ export interface ConnectProps extends Partial> { dispatch?: Dispatch; } export default ConnectState;