Skip to content

Commit ba971c4

Browse files
authored
fix: pagination type error #3159 (#3164)
1 parent e29ad47 commit ba971c4

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

components/list/index.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { provide, inject, defineComponent, App, Plugin } from 'vue';
1+
import { provide, inject, defineComponent, App, Plugin, ExtractPropTypes } from 'vue';
22
import omit from 'omit.js';
33
import PropTypes, { withUndefined } from '../_util/vue-types';
44
import classNames from '../_util/classNames';
@@ -33,6 +33,8 @@ export const ListGridType = {
3333

3434
export const ListSize = tuple('small', 'default', 'large');
3535

36+
const paginationProps = PaginationConfig();
37+
3638
export const ListProps = () => ({
3739
bordered: PropTypes.looseBool,
3840
dataSource: PropTypes.array,
@@ -42,7 +44,10 @@ export const ListProps = () => ({
4244
loading: withUndefined(PropTypes.oneOfType([PropTypes.looseBool, PropTypes.object])),
4345
loadMore: PropTypes.any,
4446
pagination: withUndefined(
45-
PropTypes.oneOfType([PropTypes.shape(PaginationConfig()).loose, PropTypes.looseBool]),
47+
PropTypes.oneOfType([
48+
PropTypes.shape<Partial<ExtractPropTypes<typeof paginationProps>>>(paginationProps).loose,
49+
PropTypes.looseBool,
50+
]),
4651
),
4752
prefixCls: PropTypes.string,
4853
rowKey: PropTypes.any,

components/table/interface.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ExtractPropTypes, PropType } from 'vue';
22
import PropTypes, { withUndefined } from '../_util/vue-types';
3-
import { PaginationProps as getPaginationProps } from '../pagination';
3+
import { PaginationProps as getPaginationProps, PaginationConfig } from '../pagination';
44
import { SpinProps as getSpinProps } from '../spin';
55
import { Store } from './createStore';
66
import { tuple } from '../_util/type';
@@ -103,16 +103,15 @@ export const tableRowSelection = {
103103

104104
export type SortOrder = 'descend' | 'ascend';
105105

106+
const paginationProps = PaginationConfig();
107+
106108
export const tableProps = {
107109
prefixCls: PropTypes.string,
108110
dropdownPrefixCls: PropTypes.string,
109111
rowSelection: PropTypes.oneOfType([PropTypes.shape(tableRowSelection).loose, Object]),
110112
pagination: withUndefined(
111113
PropTypes.oneOfType([
112-
PropTypes.shape({
113-
...PaginationProps,
114-
position: PropTypes.oneOf(tuple('top', 'bottom', 'both')),
115-
}).loose,
114+
PropTypes.shape<Partial<ExtractPropTypes<typeof paginationProps>>>(paginationProps).loose,
116115
PropTypes.looseBool,
117116
]),
118117
),

0 commit comments

Comments
 (0)