From fcd11d9bb02334355e2305202c4857442bd97b5c Mon Sep 17 00:00:00 2001 From: Carter Li Date: Fri, 10 Dec 2021 18:14:31 +0800 Subject: [PATCH] fix(components): [table-column, time-picker] improve typings (#4761) --- packages/components/table/src/table-column/defaults.ts | 2 +- packages/components/time-picker/src/common/picker.vue | 2 +- packages/components/time-picker/src/common/props.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/components/table/src/table-column/defaults.ts b/packages/components/table/src/table-column/defaults.ts index b5df5e253f..8808cd5fae 100644 --- a/packages/components/table/src/table-column/defaults.ts +++ b/packages/components/table/src/table-column/defaults.ts @@ -40,7 +40,7 @@ interface TableColumnCtx { column: TableColumnCtx, cellValue, index: number - ) => VNode + ) => VNode | string selectable: (row: T, index: number) => boolean reserveSelection: boolean filterMethod: FilterMethods diff --git a/packages/components/time-picker/src/common/picker.vue b/packages/components/time-picker/src/common/picker.vue index e5bdffead8..98836dad59 100644 --- a/packages/components/time-picker/src/common/picker.vue +++ b/packages/components/time-picker/src/common/picker.vue @@ -211,7 +211,7 @@ const parser = function ( return day.isValid() ? day : undefined } -const formatter = function (date: Date, format: string, lang: string) { +const formatter = function (date: number | Date, format: string, lang: string) { return isEmpty(format) ? date : dayjs(date).locale(lang).format(format) } diff --git a/packages/components/time-picker/src/common/props.ts b/packages/components/time-picker/src/common/props.ts index f3955d11f4..9ec3f60a11 100644 --- a/packages/components/time-picker/src/common/props.ts +++ b/packages/components/time-picker/src/common/props.ts @@ -61,7 +61,7 @@ export const timePickerDefaultProps = { default: () => ({}), }, modelValue: { - type: [Date, Array, String] as PropType, + type: [Date, Array, String] as PropType, default: '', }, rangeSeparator: {