diff --git a/components/_util/vue-types/index.ts b/components/_util/vue-types/index.ts index 63e6a5f64..a08983ba7 100644 --- a/components/_util/vue-types/index.ts +++ b/components/_util/vue-types/index.ts @@ -30,7 +30,7 @@ PropTypes.extend([ }, ]); -export function withUndefined(type: any) { +export function withUndefined(type: T): T { type.default = undefined; return type; } diff --git a/components/affix/index.tsx b/components/affix/index.tsx index 711a234c2..4254837fb 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -198,7 +198,6 @@ const Affix = defineComponent({ this.setState(newState); }, - // @ts-ignore TS6133 prepareMeasure() { this.setState({ status: AffixStatus.Prepare, diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index fdbb14534..8e798878f 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -64,15 +64,15 @@ export interface AntAnchor { unregisterLink: (link: string) => void; $data: AnchorState; scrollTo: (link: string) => void; - $emit?: Function + $emit?: Function; } interface AnchorState { - activeLink: null | string; - scrollContainer: HTMLElement | Window; - links: string[]; - scrollEvent: any; - animating: boolean; - sPrefixCls?: string; + activeLink: null | string; + scrollContainer: HTMLElement | Window; + links: string[]; + scrollEvent: any; + animating: boolean; + sPrefixCls?: string; } export default defineComponent({ @@ -242,7 +242,9 @@ export default defineComponent({ `${sPrefixCls}-link-title-active`, )[0]; if (linkNode) { - (this.$refs.inkNode as HTMLElement).style.top = `${linkNode.offsetTop + linkNode.clientHeight / 2 - 4.5}px`; + (this.$refs.inkNode as HTMLElement).style.top = `${linkNode.offsetTop + + linkNode.clientHeight / 2 - + 4.5}px`; } }, }, diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index f631fab7d..a91c89b0f 100644 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -45,7 +45,7 @@ const AutoComplete = defineComponent({ return { configProvider: inject('configProvider', defaultConfigProvider), popupRef: null, - select: null + select: null, }; }, created() { @@ -86,7 +86,7 @@ const AutoComplete = defineComponent({ const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('select', customizePrefixCls); - const { class: className} = this.$attrs as any; + const { class: className } = this.$attrs as any; const cls = { [className]: !!className, [`${prefixCls}-lg`]: size === 'large', diff --git a/components/card/Card.tsx b/components/card/Card.tsx index 2033baa4b..c969ee6a3 100644 --- a/components/card/Card.tsx +++ b/components/card/Card.tsx @@ -17,8 +17,6 @@ export interface CardTabListType { } export type CardType = 'inner'; -const CardSize = tuple('default', 'small'); -export type CardSizeType = typeof CardSize[number]; const { TabPane } = Tabs; @@ -35,10 +33,7 @@ const Card = defineComponent({ loading: PropTypes.looseBool.def(false), hoverable: PropTypes.looseBool.def(false), type: PropTypes.string, - size: { - type: String as PropType, - validator: (val: CardSizeType) => CardSize.includes(val), - }, + size: PropTypes.oneOf(tuple('default', 'small')), actions: PropTypes.VNodeChild, tabList: { type: Array as PropType, diff --git a/components/empty/index.tsx b/components/empty/index.tsx index ba15d507d..880123808 100644 --- a/components/empty/index.tsx +++ b/components/empty/index.tsx @@ -1,6 +1,6 @@ import { CSSProperties, VNodeTypes, inject, App, SetupContext, FunctionalComponent } from 'vue'; import classNames from '../_util/classNames'; -import { defaultConfigProvider, ConfigConsumerProps } from '../config-provider'; +import { defaultConfigProvider } from '../config-provider'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import DefaultEmptyImg from './empty'; import SimpleEmptyImg from './simple'; @@ -11,7 +11,7 @@ const defaultEmptyImg = ; const simpleEmptyImg = ; export interface TransferLocale { - description: string; + description?: string; } export interface EmptyProps { @@ -31,7 +31,7 @@ interface EmptyType extends FunctionalComponent { } const Empty: EmptyType = (props: EmptyProps, { slots = {}, attrs }: SetupContext) => { - const configProvider = inject('configProvider', defaultConfigProvider); + const configProvider = inject('configProvider', defaultConfigProvider); const { getPrefixCls, direction } = configProvider; const { prefixCls: customizePrefixCls, diff --git a/components/locale-provider/LocaleReceiver.tsx b/components/locale-provider/LocaleReceiver.tsx index e00f58db6..b48bd13c8 100644 --- a/components/locale-provider/LocaleReceiver.tsx +++ b/components/locale-provider/LocaleReceiver.tsx @@ -1,4 +1,5 @@ import { inject, defineComponent, VNodeTypes, PropType } from 'vue'; +import PropTypes from '../_util/vue-types'; import defaultLocaleData from './default'; import { Locale } from '.'; @@ -12,12 +13,14 @@ interface LocaleInterface { [key: string]: any; } +export interface LocaleReceiverContext { + antLocale?: LocaleInterface; +} + export default defineComponent({ name: 'LocaleReceiver', props: { - componentName: { - type: String, - }, + componentName: PropTypes.string, defaultLocale: { type: [Object, Function], }, @@ -29,7 +32,7 @@ export default defineComponent({ }, setup() { return { - localeData: inject('localeData', {}), + localeData: inject('localeData', {}), }; }, methods: { diff --git a/components/locale-provider/index.tsx b/components/locale-provider/index.tsx index 1fdb8ffba..129bfca39 100644 --- a/components/locale-provider/index.tsx +++ b/components/locale-provider/index.tsx @@ -1,4 +1,4 @@ -import { provide, App, defineComponent, VNode } from 'vue'; +import { provide, App, defineComponent, VNode, PropType } from 'vue'; import PropTypes from '../_util/vue-types'; import moment from 'moment'; import interopDefault from '../_util/interopDefault'; @@ -39,7 +39,7 @@ const LocaleProvider = defineComponent({ name: 'ALocaleProvider', props: { locale: { - type: Object, + type: Object as PropType, }, _ANT_MARK__: PropTypes.string, }, diff --git a/components/vc-select2/OptGroup.tsx b/components/vc-select2/OptGroup.tsx index 65afe9e77..2b5deccce 100644 --- a/components/vc-select2/OptGroup.tsx +++ b/components/vc-select2/OptGroup.tsx @@ -2,7 +2,7 @@ import { FunctionalComponent } from 'vue'; import { OptionGroupData } from './interface'; -export interface OptGroupProps extends Omit {} +export type OptGroupProps = Omit; export interface OptionGroupFC extends FunctionalComponent { /** Legacy for check if is a Option Group */ diff --git a/components/vc-select2/generate.tsx b/components/vc-select2/generate.tsx index 776aca9f5..3d0ae48db 100644 --- a/components/vc-select2/generate.tsx +++ b/components/vc-select2/generate.tsx @@ -254,7 +254,7 @@ export default function generateSelector< const mergedId = computed(() => props.id || `rc_select_${getUUID()}`); // optionLabelProp - let mergedOptionLabelProp = computed(() => { + const mergedOptionLabelProp = computed(() => { let mergedOptionLabelProp = props.optionLabelProp; if (mergedOptionLabelProp === undefined) { mergedOptionLabelProp = props.options ? 'label' : 'children'; @@ -554,7 +554,7 @@ export default function generateSelector< // ============================== Open ============================== const innerOpen = ref(undefined); - let mergedOpen = ref(undefined); + const mergedOpen = ref(undefined); const setInnerOpen = (val: boolean) => { innerOpen.value = val; mergedOpen.value = innerOpen.value; diff --git a/components/vc-tabs/src/ScrollableInkTabBar.jsx b/components/vc-tabs/src/ScrollableInkTabBar.jsx index b9dc5ec41..8c68e9941 100644 --- a/components/vc-tabs/src/ScrollableInkTabBar.jsx +++ b/components/vc-tabs/src/ScrollableInkTabBar.jsx @@ -1,10 +1,11 @@ +import { defineComponent } from 'vue'; import InkTabBarNode from './InkTabBarNode'; import TabBarTabsNode from './TabBarTabsNode'; import TabBarRootNode from './TabBarRootNode'; import ScrollableTabBarNode from './ScrollableTabBarNode'; import SaveRef from './SaveRef'; -export default { +export default defineComponent({ name: 'ScrollableInkTabBar', inheritAttrs: false, render() { @@ -22,4 +23,4 @@ export default { /> ); }, -}; +});