diff --git a/src/useAntdTable/index.ts b/src/useAntdTable/index.ts index 53d423081c..dd5bac1c13 100644 --- a/src/useAntdTable/index.ts +++ b/src/useAntdTable/index.ts @@ -6,8 +6,8 @@ import useUpdateEffect from '../useUpdateEffect'; interface UseTableFormUtils extends WrappedFormUtils { getFieldInstance?: (name: string) => {}; } -export interface ReturnValue { - data: unknown; +export interface ReturnValue { + data: T; loading: boolean; current: number; pageSize: number; @@ -75,11 +75,11 @@ const reducer = (state = initState, action: { type: string; payload?: {} }) => { } }; -export default function useAntdTable( +export default function useAntdTable( fn: (params: FnParams) => Promise, deps: DependencyList = [], options: Options = {}, -): ReturnValue { +): ReturnValue { const { defaultPageSize = 10, id, form } = options; const [state, dispatch] = useReducer(reducer, { ...initState, pageSize: defaultPageSize }); const stateRef = useRef(({} as unknown) as UseTableInitState); @@ -241,9 +241,9 @@ export default function useAntdTable( }); }; - const result: ReturnValue = { + const result: ReturnValue = { changeTable, - data: state.data, + data: state.data as T, current: state.current, pageSize: state.pageSize, loading: state.loading,