fix: ts type error

pull/4936/head
tangjinzhou 2022-01-11 23:23:07 +08:00
parent 9693e4b10b
commit b25c5cc28e
9 changed files with 19 additions and 14 deletions

View File

@ -1,3 +1,4 @@
import type { ExtractPropTypes } from 'vue';
import { defineComponent, inject } from 'vue'; import { defineComponent, inject } from 'vue';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import debounce from 'lodash-es/debounce'; import debounce from 'lodash-es/debounce';
@ -9,7 +10,7 @@ import SlickCarousel from '../vc-slick/src';
import { tuple, withInstall } from '../_util/type'; import { tuple, withInstall } from '../_util/type';
// Carousel // Carousel
export const CarouselProps = { export const carouselProps = {
effect: PropTypes.oneOf(tuple('scrollx', 'fade')), effect: PropTypes.oneOf(tuple('scrollx', 'fade')),
dots: PropTypes.looseBool.def(true), dots: PropTypes.looseBool.def(true),
vertical: PropTypes.looseBool, vertical: PropTypes.looseBool,
@ -53,11 +54,11 @@ export const CarouselProps = {
dotPosition: PropTypes.oneOf(tuple('top', 'bottom', 'left', 'right')), dotPosition: PropTypes.oneOf(tuple('top', 'bottom', 'left', 'right')),
verticalSwiping: PropTypes.looseBool.def(false), verticalSwiping: PropTypes.looseBool.def(false),
}; };
export type CarouselProps = Partial<ExtractPropTypes<typeof carouselProps>>;
const Carousel = defineComponent({ const Carousel = defineComponent({
name: 'ACarousel', name: 'ACarousel',
inheritAttrs: false, inheritAttrs: false,
props: CarouselProps, props: carouselProps,
setup() { setup() {
return { return {
configProvider: inject('configProvider', defaultConfigProvider), configProvider: inject('configProvider', defaultConfigProvider),

View File

@ -69,6 +69,7 @@ export { default as Divider } from './divider';
export type { DropdownProps } from './dropdown'; export type { DropdownProps } from './dropdown';
export { default as Dropdown, DropdownButton } from './dropdown'; export { default as Dropdown, DropdownButton } from './dropdown';
export type { DrawerProps } from './drawer';
export { default as Drawer } from './drawer'; export { default as Drawer } from './drawer';
export type { EmptyProps } from './empty'; export type { EmptyProps } from './empty';
@ -130,6 +131,7 @@ export { default as Popover } from './popover';
export type { ProgressProps } from './progress'; export type { ProgressProps } from './progress';
export { default as Progress } from './progress'; export { default as Progress } from './progress';
export type { RadioProps, RadioChangeEvent, RadioGroupProps } from './radio';
export { default as Radio, RadioButton, RadioGroup } from './radio'; export { default as Radio, RadioButton, RadioGroup } from './radio';
export type { RateProps } from './rate'; export type { RateProps } from './rate';

View File

@ -74,7 +74,7 @@ const drawerProps = () => ({
afterVisibleChange: PropTypes.func, afterVisibleChange: PropTypes.func,
}); });
export type DrawerProps = Partial<ExtractPropTypes<typeof drawerProps>>; export type DrawerProps = Partial<ExtractPropTypes<ReturnType<typeof drawerProps>>>;
const Drawer = defineComponent({ const Drawer = defineComponent({
name: 'ADrawer', name: 'ADrawer',

View File

@ -1,4 +1,4 @@
import type { CSSProperties, VNodeTypes, FunctionalComponent } from 'vue'; import type { CSSProperties, FunctionalComponent } from 'vue';
import { inject } from 'vue'; import { inject } from 'vue';
import classNames from '../_util/classNames'; import classNames from '../_util/classNames';
import { defaultConfigProvider } from '../config-provider'; import { defaultConfigProvider } from '../config-provider';
@ -7,6 +7,7 @@ import DefaultEmptyImg from './empty';
import SimpleEmptyImg from './simple'; import SimpleEmptyImg from './simple';
import { filterEmpty } from '../_util/props-util'; import { filterEmpty } from '../_util/props-util';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import type { VueNode } from '../_util/type';
import { withInstall } from '../_util/type'; import { withInstall } from '../_util/type';
const defaultEmptyImg = <DefaultEmptyImg />; const defaultEmptyImg = <DefaultEmptyImg />;
@ -21,14 +22,14 @@ export interface EmptyProps {
class?: any; class?: any;
style?: string | CSSProperties; style?: string | CSSProperties;
imageStyle?: CSSProperties; imageStyle?: CSSProperties;
image?: VNodeTypes | null; image?: VueNode | null;
description?: VNodeTypes; description?: VueNode;
} }
interface EmptyType extends FunctionalComponent<EmptyProps> { interface EmptyType extends FunctionalComponent<EmptyProps> {
displayName: string; displayName: string;
PRESENTED_IMAGE_DEFAULT: VNodeTypes; PRESENTED_IMAGE_DEFAULT: VueNode;
PRESENTED_IMAGE_SIMPLE: VNodeTypes; PRESENTED_IMAGE_SIMPLE: VueNode;
} }
const Empty: EmptyType = (props, { slots = {}, attrs }) => { const Empty: EmptyType = (props, { slots = {}, attrs }) => {

View File

@ -86,7 +86,7 @@ const textAreaProps = {
...omit(inputProps, ['prefix', 'addonBefore', 'addonAfter', 'suffix']), ...omit(inputProps, ['prefix', 'addonBefore', 'addonAfter', 'suffix']),
autosize: { type: [Boolean, Object] as PropType<AutoSizeType>, default: undefined }, autosize: { type: [Boolean, Object] as PropType<AutoSizeType>, default: undefined },
autoSize: { type: [Boolean, Object] as PropType<AutoSizeType>, default: undefined }, autoSize: { type: [Boolean, Object] as PropType<AutoSizeType>, default: undefined },
showCount: { type: [Boolean, Object] as PropType<ShowCountProps> }, showCount: { type: [Boolean, Object] as PropType<boolean | ShowCountProps> },
onResize: { type: Function as PropType<(size: { width: number; height: number }) => void> }, onResize: { type: Function as PropType<(size: { width: number; height: number }) => void> },
onCompositionstart: PropTypes.func, onCompositionstart: PropTypes.func,
onCompositionend: PropTypes.func, onCompositionend: PropTypes.func,

View File

@ -2,7 +2,8 @@ import type { App, Plugin } from 'vue';
import Radio from './Radio'; import Radio from './Radio';
import Group from './Group'; import Group from './Group';
import Button from './RadioButton'; import Button from './RadioButton';
export type { RadioProps } from './Radio';
export type { RadioGroupProps } from './Group';
export type { RadioChangeEventTarget, RadioChangeEvent } from './interface'; export type { RadioChangeEventTarget, RadioChangeEvent } from './interface';
Radio.Group = Group; Radio.Group = Group;

View File

@ -20,7 +20,7 @@ export type OptionType = typeof Option;
export interface LabeledValue { export interface LabeledValue {
key?: string; key?: string;
value: RawValue; value: RawValue;
label: any; label?: any;
} }
export type SelectValue = RawValue | RawValue[] | LabeledValue | LabeledValue[] | undefined; export type SelectValue = RawValue | RawValue[] | LabeledValue | LabeledValue[] | undefined;

View File

@ -61,7 +61,7 @@ export interface EllipsisConfig {
symbol?: string; symbol?: string;
onExpand?: EventHandler; onExpand?: EventHandler;
onEllipsis?: (ellipsis: boolean) => void; onEllipsis?: (ellipsis: boolean) => void;
tooltip?: boolean; tooltip?: any;
} }
export interface BlockProps extends TypographyProps { export interface BlockProps extends TypographyProps {

View File

@ -6,7 +6,7 @@ import type { AlignType } from '../interface';
import { getCellFixedInfo } from '../utils/fixUtil'; import { getCellFixedInfo } from '../utils/fixUtil';
export interface SummaryCellProps { export interface SummaryCellProps {
index: number; index?: number;
colSpan?: number; colSpan?: number;
rowSpan?: number; rowSpan?: number;
align?: AlignType; align?: AlignType;