diff --git a/components/time-picker/time-picker.tsx b/components/time-picker/time-picker.tsx index a4fb17775..c349f69f6 100644 --- a/components/time-picker/time-picker.tsx +++ b/components/time-picker/time-picker.tsx @@ -58,15 +58,18 @@ export type TimePickerProps = CommonProps & addon?: () => void; }; -function createTimePicker(generateConfig: GenerateConfig) { +function createTimePicker< + DateType, + DTimePickerProps extends TimePickerProps = TimePickerProps, + DTimeRangePickerProps extends TimeRangePickerProps = TimeRangePickerProps, +>(generateConfig: GenerateConfig) { const DatePicker = generatePicker(generateConfig, { ...timePickerProps, order: { type: Boolean, default: true }, }); const { TimePicker: InternalTimePicker, RangePicker: InternalRangePicker } = DatePicker as any; - - const TimePicker = defineComponent({ + const TimePicker = defineComponent({ name: 'ATimePicker', inheritAttrs: false, props: { @@ -74,7 +77,7 @@ function createTimePicker(generateConfig: GenerateConfig) { ...datePickerProps(), ...timePickerProps, addon: { type: Function }, - }, + } as any, slot: ['addon', 'renderExtraFooter', 'suffixIcon', 'clearIcon'], setup(props, { slots, expose, emit, attrs }) { const formItemContext = useInjectFormItemContext(); @@ -136,7 +139,7 @@ function createTimePicker(generateConfig: GenerateConfig) { }, }); - const TimeRangePicker = defineComponent({ + const TimeRangePicker = defineComponent({ name: 'ATimeRangePicker', inheritAttrs: false, props: { @@ -144,7 +147,7 @@ function createTimePicker(generateConfig: GenerateConfig) { ...rangePickerProps(), ...timePickerProps, order: { type: Boolean, default: true }, - }, + } as any, slot: ['renderExtraFooter', 'suffixIcon', 'clearIcon'], setup(props, { slots, expose, emit, attrs }) { const pickerRef = ref();