Skip to content

Commit 321989b

Browse files
committed
feat: update collapse type
1 parent 2f51f2d commit 321989b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

components/_util/type.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ export function stringType<T extends string = string>(defaultVal?: T) {
7474
return { type: String as unknown as PropType<T>, default: defaultVal as T };
7575
}
7676

77-
export function someType<T>(types: any[], defaultVal?: T) {
78-
return { type: types as PropType<T>, default: defaultVal as T };
77+
export function someType<T>(types?: any[], defaultVal?: T) {
78+
return types ? { type: types as PropType<T>, default: defaultVal as T } : anyType<T>(defaultVal);
7979
}

components/collapse/commonProps.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Key } from '../_util/type';
2-
import { tuple, booleanType, someType, stringType, functionType } from '../_util/type';
2+
import { booleanType, someType, stringType, functionType } from '../_util/type';
33
import PropTypes from '../_util/vue-types';
44

55
export type CollapsibleType = 'header' | 'icon' | 'disabled';
@@ -26,7 +26,7 @@ const collapseProps = () => ({
2626
bordered: booleanType(),
2727
expandIcon: functionType<(panelProps: PanelProps) => any>(),
2828
openAnimation: PropTypes.object,
29-
expandIconPosition: PropTypes.oneOf(tuple('start', 'end')),
29+
expandIconPosition: stringType<'start' | 'end'>(),
3030
collapsible: stringType<CollapsibleType>(),
3131
ghost: booleanType(),
3232
onChange: functionType<(key: Key | Key[]) => void>(),
@@ -47,7 +47,7 @@ const collapsePanelProps = () => ({
4747
forceRender: booleanType(),
4848
expandIcon: functionType<(panelProps: PanelProps) => any>(),
4949
extra: PropTypes.any,
50-
panelKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
50+
panelKey: someType<number | string>(),
5151
collapsible: stringType<CollapsibleType>(),
5252
role: String,
5353
onItemClick: functionType<(panelKey: Key) => void>(),

0 commit comments

Comments
 (0)