From 3fc7a050ec53b98abd5d1f14bd1890fc04eaf5ea Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 3 Jan 2022 23:14:08 +0800 Subject: [PATCH] fix: component ts build error --- components/time-picker/time-picker.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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<DateType> = CommonProps<DateType> & addon?: () => void; }; -function createTimePicker<DateType>(generateConfig: GenerateConfig<DateType>) { +function createTimePicker< + DateType, + DTimePickerProps extends TimePickerProps<DateType> = TimePickerProps<DateType>, + DTimeRangePickerProps extends TimeRangePickerProps<DateType> = TimeRangePickerProps<DateType>, +>(generateConfig: GenerateConfig<DateType>) { const DatePicker = generatePicker<DateType>(generateConfig, { ...timePickerProps, order: { type: Boolean, default: true }, }); const { TimePicker: InternalTimePicker, RangePicker: InternalRangePicker } = DatePicker as any; - - const TimePicker = defineComponent({ + const TimePicker = defineComponent<DTimePickerProps>({ name: 'ATimePicker', inheritAttrs: false, props: { @@ -74,7 +77,7 @@ function createTimePicker<DateType>(generateConfig: GenerateConfig<DateType>) { ...datePickerProps<DateType>(), ...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<DateType>(generateConfig: GenerateConfig<DateType>) { }, }); - const TimeRangePicker = defineComponent({ + const TimeRangePicker = defineComponent<DTimeRangePickerProps>({ name: 'ATimeRangePicker', inheritAttrs: false, props: { @@ -144,7 +147,7 @@ function createTimePicker<DateType>(generateConfig: GenerateConfig<DateType>) { ...rangePickerProps<DateType>(), ...timePickerProps, order: { type: Boolean, default: true }, - }, + } as any, slot: ['renderExtraFooter', 'suffixIcon', 'clearIcon'], setup(props, { slots, expose, emit, attrs }) { const pickerRef = ref();