Skip to content

Commit 3fc7a05

Browse files
committed
fix: component ts build error
1 parent 5b20498 commit 3fc7a05

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

components/time-picker/time-picker.tsx

+9-6
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,26 @@ export type TimePickerProps<DateType> = CommonProps<DateType> &
5858
addon?: () => void;
5959
};
6060

61-
function createTimePicker<DateType>(generateConfig: GenerateConfig<DateType>) {
61+
function createTimePicker<
62+
DateType,
63+
DTimePickerProps extends TimePickerProps<DateType> = TimePickerProps<DateType>,
64+
DTimeRangePickerProps extends TimeRangePickerProps<DateType> = TimeRangePickerProps<DateType>,
65+
>(generateConfig: GenerateConfig<DateType>) {
6266
const DatePicker = generatePicker<DateType>(generateConfig, {
6367
...timePickerProps,
6468
order: { type: Boolean, default: true },
6569
});
6670

6771
const { TimePicker: InternalTimePicker, RangePicker: InternalRangePicker } = DatePicker as any;
68-
69-
const TimePicker = defineComponent({
72+
const TimePicker = defineComponent<DTimePickerProps>({
7073
name: 'ATimePicker',
7174
inheritAttrs: false,
7275
props: {
7376
...commonProps<DateType>(),
7477
...datePickerProps<DateType>(),
7578
...timePickerProps,
7679
addon: { type: Function },
77-
},
80+
} as any,
7881
slot: ['addon', 'renderExtraFooter', 'suffixIcon', 'clearIcon'],
7982
setup(props, { slots, expose, emit, attrs }) {
8083
const formItemContext = useInjectFormItemContext();
@@ -136,15 +139,15 @@ function createTimePicker<DateType>(generateConfig: GenerateConfig<DateType>) {
136139
},
137140
});
138141

139-
const TimeRangePicker = defineComponent({
142+
const TimeRangePicker = defineComponent<DTimeRangePickerProps>({
140143
name: 'ATimeRangePicker',
141144
inheritAttrs: false,
142145
props: {
143146
...commonProps<DateType>(),
144147
...rangePickerProps<DateType>(),
145148
...timePickerProps,
146149
order: { type: Boolean, default: true },
147-
},
150+
} as any,
148151
slot: ['renderExtraFooter', 'suffixIcon', 'clearIcon'],
149152
setup(props, { slots, expose, emit, attrs }) {
150153
const pickerRef = ref();

0 commit comments

Comments
 (0)