From b25c5cc28e294c8a520dce694ba7243fe3f81884 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Tue, 11 Jan 2022 23:23:07 +0800 Subject: [PATCH] fix: ts type error --- components/carousel/index.tsx | 7 ++++--- components/components.ts | 2 ++ components/drawer/index.tsx | 2 +- components/empty/index.tsx | 11 ++++++----- components/input/inputProps.ts | 2 +- components/radio/index.ts | 3 ++- components/select/index.tsx | 2 +- components/typography/Base.tsx | 2 +- components/vc-table/Footer/Cell.tsx | 2 +- 9 files changed, 19 insertions(+), 14 deletions(-) diff --git a/components/carousel/index.tsx b/components/carousel/index.tsx index 1edfcdc8e..d1b44230f 100644 --- a/components/carousel/index.tsx +++ b/components/carousel/index.tsx @@ -1,3 +1,4 @@ +import type { ExtractPropTypes } from 'vue'; import { defineComponent, inject } from 'vue'; import PropTypes from '../_util/vue-types'; import debounce from 'lodash-es/debounce'; @@ -9,7 +10,7 @@ import SlickCarousel from '../vc-slick/src'; import { tuple, withInstall } from '../_util/type'; // Carousel -export const CarouselProps = { +export const carouselProps = { effect: PropTypes.oneOf(tuple('scrollx', 'fade')), dots: PropTypes.looseBool.def(true), vertical: PropTypes.looseBool, @@ -53,11 +54,11 @@ export const CarouselProps = { dotPosition: PropTypes.oneOf(tuple('top', 'bottom', 'left', 'right')), verticalSwiping: PropTypes.looseBool.def(false), }; - +export type CarouselProps = Partial>; const Carousel = defineComponent({ name: 'ACarousel', inheritAttrs: false, - props: CarouselProps, + props: carouselProps, setup() { return { configProvider: inject('configProvider', defaultConfigProvider), diff --git a/components/components.ts b/components/components.ts index 458db5b6f..7555b38b8 100644 --- a/components/components.ts +++ b/components/components.ts @@ -69,6 +69,7 @@ export { default as Divider } from './divider'; export type { DropdownProps } from './dropdown'; export { default as Dropdown, DropdownButton } from './dropdown'; +export type { DrawerProps } from './drawer'; export { default as Drawer } from './drawer'; export type { EmptyProps } from './empty'; @@ -130,6 +131,7 @@ export { default as Popover } from './popover'; export type { ProgressProps } from './progress'; export { default as Progress } from './progress'; +export type { RadioProps, RadioChangeEvent, RadioGroupProps } from './radio'; export { default as Radio, RadioButton, RadioGroup } from './radio'; export type { RateProps } from './rate'; diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index b0513f780..386f91a60 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -74,7 +74,7 @@ const drawerProps = () => ({ afterVisibleChange: PropTypes.func, }); -export type DrawerProps = Partial>; +export type DrawerProps = Partial>>; const Drawer = defineComponent({ name: 'ADrawer', diff --git a/components/empty/index.tsx b/components/empty/index.tsx index 3c4ff9d98..20a3856fb 100644 --- a/components/empty/index.tsx +++ b/components/empty/index.tsx @@ -1,4 +1,4 @@ -import type { CSSProperties, VNodeTypes, FunctionalComponent } from 'vue'; +import type { CSSProperties, FunctionalComponent } from 'vue'; import { inject } from 'vue'; import classNames from '../_util/classNames'; import { defaultConfigProvider } from '../config-provider'; @@ -7,6 +7,7 @@ import DefaultEmptyImg from './empty'; import SimpleEmptyImg from './simple'; import { filterEmpty } from '../_util/props-util'; import PropTypes from '../_util/vue-types'; +import type { VueNode } from '../_util/type'; import { withInstall } from '../_util/type'; const defaultEmptyImg = ; @@ -21,14 +22,14 @@ export interface EmptyProps { class?: any; style?: string | CSSProperties; imageStyle?: CSSProperties; - image?: VNodeTypes | null; - description?: VNodeTypes; + image?: VueNode | null; + description?: VueNode; } interface EmptyType extends FunctionalComponent { displayName: string; - PRESENTED_IMAGE_DEFAULT: VNodeTypes; - PRESENTED_IMAGE_SIMPLE: VNodeTypes; + PRESENTED_IMAGE_DEFAULT: VueNode; + PRESENTED_IMAGE_SIMPLE: VueNode; } const Empty: EmptyType = (props, { slots = {}, attrs }) => { diff --git a/components/input/inputProps.ts b/components/input/inputProps.ts index f488fc3a4..86db5ef09 100644 --- a/components/input/inputProps.ts +++ b/components/input/inputProps.ts @@ -86,7 +86,7 @@ const textAreaProps = { ...omit(inputProps, ['prefix', 'addonBefore', 'addonAfter', 'suffix']), autosize: { type: [Boolean, Object] as PropType, default: undefined }, autoSize: { type: [Boolean, Object] as PropType, default: undefined }, - showCount: { type: [Boolean, Object] as PropType }, + showCount: { type: [Boolean, Object] as PropType }, onResize: { type: Function as PropType<(size: { width: number; height: number }) => void> }, onCompositionstart: PropTypes.func, onCompositionend: PropTypes.func, diff --git a/components/radio/index.ts b/components/radio/index.ts index a12b45c6e..b8494cd39 100644 --- a/components/radio/index.ts +++ b/components/radio/index.ts @@ -2,7 +2,8 @@ import type { App, Plugin } from 'vue'; import Radio from './Radio'; import Group from './Group'; import Button from './RadioButton'; - +export type { RadioProps } from './Radio'; +export type { RadioGroupProps } from './Group'; export type { RadioChangeEventTarget, RadioChangeEvent } from './interface'; Radio.Group = Group; diff --git a/components/select/index.tsx b/components/select/index.tsx index 836bbb539..5a530eac9 100644 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -20,7 +20,7 @@ export type OptionType = typeof Option; export interface LabeledValue { key?: string; value: RawValue; - label: any; + label?: any; } export type SelectValue = RawValue | RawValue[] | LabeledValue | LabeledValue[] | undefined; diff --git a/components/typography/Base.tsx b/components/typography/Base.tsx index d9f41171b..65b1fa04e 100644 --- a/components/typography/Base.tsx +++ b/components/typography/Base.tsx @@ -61,7 +61,7 @@ export interface EllipsisConfig { symbol?: string; onExpand?: EventHandler; onEllipsis?: (ellipsis: boolean) => void; - tooltip?: boolean; + tooltip?: any; } export interface BlockProps extends TypographyProps { diff --git a/components/vc-table/Footer/Cell.tsx b/components/vc-table/Footer/Cell.tsx index 34c077084..6546e39be 100644 --- a/components/vc-table/Footer/Cell.tsx +++ b/components/vc-table/Footer/Cell.tsx @@ -6,7 +6,7 @@ import type { AlignType } from '../interface'; import { getCellFixedInfo } from '../utils/fixUtil'; export interface SummaryCellProps { - index: number; + index?: number; colSpan?: number; rowSpan?: number; align?: AlignType;