Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/umijs/hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
brickspert committed Aug 13, 2019
2 parents cb418f4 + e9ffd51 commit 5dbb983
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/useAntdTable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import useUpdateEffect from '../useUpdateEffect';
interface UseTableFormUtils extends WrappedFormUtils {
getFieldInstance?: (name: string) => {};
}
export interface ReturnValue {
data: unknown;
export interface ReturnValue<T> {
data: T;
loading: boolean;
current: number;
pageSize: number;
Expand Down Expand Up @@ -75,11 +75,11 @@ const reducer = (state = initState, action: { type: string; payload?: {} }) => {
}
};

export default function useAntdTable(
export default function useAntdTable<T>(
fn: (params: FnParams) => Promise<any>,
deps: DependencyList = [],
options: Options = {},
): ReturnValue {
): ReturnValue<T> {
const { defaultPageSize = 10, id, form } = options;
const [state, dispatch] = useReducer(reducer, { ...initState, pageSize: defaultPageSize });
const stateRef = useRef<UseTableInitState>(({} as unknown) as UseTableInitState);
Expand Down Expand Up @@ -241,9 +241,9 @@ export default function useAntdTable(
});
};

const result: ReturnValue = {
const result: ReturnValue<T> = {
changeTable,
data: state.data,
data: state.data as T,
current: state.current,
pageSize: state.pageSize,
loading: state.loading,
Expand Down

0 comments on commit 5dbb983

Please sign in to comment.