Skip to content

Commit d028cce

Browse files
authored
chore: use type import (#4260)
1 parent b1bb913 commit d028cce

File tree

229 files changed

+549
-633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+549
-633
lines changed

.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"rules": {
3131
"@typescript-eslint/no-explicit-any": 0,
3232
"@typescript-eslint/ban-types": 0,
33+
"@typescript-eslint/consistent-type-imports": 1,
3334
"@typescript-eslint/explicit-module-boundary-types": 0,
3435
"@typescript-eslint/no-empty-function": 0,
3536
"@typescript-eslint/no-non-null-assertion": 0,

components/_util/colors.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ElementOf, tuple } from './type';
1+
import type { ElementOf } from './type';
2+
import { tuple } from './type';
23

34
export const PresetStatusColorTypes = tuple('success', 'processing', 'error', 'default', 'warning');
45

components/_util/hooks/useBreakpoint.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { onMounted, onUnmounted, Ref, ref } from 'vue';
2-
import ResponsiveObserve, { ScreenMap } from '../../_util/responsiveObserve';
1+
import type { Ref } from 'vue';
2+
import { onMounted, onUnmounted, ref } from 'vue';
3+
import type { ScreenMap } from '../../_util/responsiveObserve';
4+
import ResponsiveObserve from '../../_util/responsiveObserve';
35

46
function useBreakpoint(): Ref<ScreenMap> {
57
const screens = ref<ScreenMap>({});

components/_util/hooks/useConfigInject.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import { RequiredMark } from '../../form/Form';
2-
import { computed, ComputedRef, inject, UnwrapRef, VNodeChild } from 'vue';
3-
import {
4-
ConfigProviderProps,
5-
defaultConfigProvider,
6-
Direction,
7-
SizeType,
8-
} from '../../config-provider';
1+
import type { RequiredMark } from '../../form/Form';
2+
import type { ComputedRef, UnwrapRef, VNodeChild } from 'vue';
3+
import { computed, inject } from 'vue';
4+
import type { ConfigProviderProps, Direction, SizeType } from '../../config-provider';
5+
import { defaultConfigProvider } from '../../config-provider';
96

107
export default (
118
name: string,

components/_util/hooks/useMemo.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Ref, ref, watch } from 'vue';
1+
import type { Ref } from 'vue';
2+
import { ref, watch } from 'vue';
23

34
export default function useMemo<T>(
45
getValue: () => T,

components/_util/hooks/usePrefixCls.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { computed, ComputedRef, inject } from 'vue';
1+
import type { ComputedRef } from 'vue';
2+
import { computed, inject } from 'vue';
23
import { defaultConfigProvider } from '../../config-provider';
34

45
export default (name: string, props: Record<any, any>): ComputedRef<string> => {

components/_util/hooks/useRef.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { onBeforeUpdate, ref, Ref } from 'vue';
1+
import type { Ref } from 'vue';
2+
import { onBeforeUpdate, ref } from 'vue';
23

34
export type UseRef = [(el: any, key: string | number) => void, Ref<any>];
45

components/_util/hooks/useSize.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { computed, ComputedRef, inject, provide, UnwrapRef } from 'vue';
2-
import { ConfigProviderProps, defaultConfigProvider, SizeType } from '../../config-provider';
1+
import type { ComputedRef, UnwrapRef } from 'vue';
2+
import { computed, inject, provide } from 'vue';
3+
import type { ConfigProviderProps, SizeType } from '../../config-provider';
4+
import { defaultConfigProvider } from '../../config-provider';
35

46
const sizeProvider = Symbol('SizeProvider');
57

components/_util/props-util/initDefaultProps.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { PropType } from 'vue';
2-
import { VueTypeValidableDef, VueTypeDef } from 'vue-types';
1+
import type { PropType } from 'vue';
2+
import type { VueTypeValidableDef, VueTypeDef } from 'vue-types';
33

44
const initDefaultProps = <T>(
55
types: T,

components/_util/setStyle.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CSSProperties } from 'vue';
1+
import type { CSSProperties } from 'vue';
22

33
/**
44
* Easy to set element style, return previous style

components/_util/transButton.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { defineComponent, CSSProperties, ref, onMounted } from 'vue';
1+
import type { CSSProperties } from 'vue';
2+
import { defineComponent, ref, onMounted } from 'vue';
23
/**
34
* Wrap of sub component which need use as Button capacity (like Icon component).
45
* This helps accessibility reader to tread as a interactive button to operation.

components/_util/transition.tsx

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
import {
2-
BaseTransitionProps,
3-
CSSProperties,
4-
defineComponent,
5-
nextTick,
6-
Ref,
7-
Transition as T,
8-
TransitionGroup as TG,
9-
} from 'vue';
1+
import type { BaseTransitionProps, CSSProperties, Ref } from 'vue';
2+
import { defineComponent, nextTick, Transition as T, TransitionGroup as TG } from 'vue';
103
import { findDOMNode } from './props-util';
114

125
export const getTransitionProps = (transitionName: string, opt: object = {}) => {

components/_util/type.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, PropType, VNodeChild, Plugin } from 'vue';
1+
import type { App, PropType, VNodeChild, Plugin } from 'vue';
22

33
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
44
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead

components/_util/vue-types/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { CSSProperties } from 'vue';
2-
import { createTypes, VueTypeValidableDef, VueTypesInterface } from 'vue-types';
3-
import { VueNode } from '../type';
1+
import type { CSSProperties } from 'vue';
2+
import type { VueTypeValidableDef, VueTypesInterface } from 'vue-types';
3+
import { createTypes } from 'vue-types';
4+
import type { VueNode } from '../type';
45
const PropTypes = createTypes({
56
func: undefined,
67
bool: undefined,

components/affix/index.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import type { CSSProperties, ExtractPropTypes } from 'vue';
12
import {
2-
CSSProperties,
33
defineComponent,
44
ref,
55
reactive,
@@ -9,7 +9,6 @@ import {
99
computed,
1010
onUnmounted,
1111
onUpdated,
12-
ExtractPropTypes,
1312
} from 'vue';
1413
import PropTypes from '../_util/vue-types';
1514
import classNames from '../_util/classNames';

components/affix/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import addEventListener from '../vc-util/Dom/addEventListener';
2-
import { ComponentPublicInstance } from 'vue';
2+
import type { ComponentPublicInstance } from 'vue';
33
import supportsPassive from '../_util/supportsPassive';
44

55
export type BindElement = HTMLElement | Window | null | undefined;

components/alert/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { inject, cloneVNode, defineComponent, ref, ExtractPropTypes } from 'vue';
1+
import type { ExtractPropTypes } from 'vue';
2+
import { inject, cloneVNode, defineComponent, ref } from 'vue';
23
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
34
import CheckCircleOutlined from '@ant-design/icons-vue/CheckCircleOutlined';
45
import ExclamationCircleOutlined from '@ant-design/icons-vue/ExclamationCircleOutlined';

components/anchor/Anchor.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { ExtractPropTypes } from 'vue';
12
import {
23
defineComponent,
34
nextTick,
@@ -6,7 +7,6 @@ import {
67
onUpdated,
78
reactive,
89
ref,
9-
ExtractPropTypes,
1010
computed,
1111
} from 'vue';
1212
import PropTypes from '../_util/vue-types';

components/anchor/AnchorLink.tsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import {
2-
defineComponent,
3-
ExtractPropTypes,
4-
nextTick,
5-
onBeforeUnmount,
6-
onMounted,
7-
watch,
8-
} from 'vue';
1+
import type { ExtractPropTypes } from 'vue';
2+
import { defineComponent, nextTick, onBeforeUnmount, onMounted, watch } from 'vue';
93
import PropTypes from '../_util/vue-types';
104
import { getPropsSlot } from '../_util/props-util';
115
import classNames from '../_util/classNames';

components/anchor/context.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { computed, Ref, inject, InjectionKey, provide } from 'vue';
1+
import type { Ref, InjectionKey } from 'vue';
2+
import { computed, inject, provide } from 'vue';
23

34
export interface AnchorContext {
45
registerLink: (link: string) => void;

components/anchor/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, Plugin } from 'vue';
1+
import type { App, Plugin } from 'vue';
22
import Anchor, { AnchorProps } from './Anchor';
33
import AnchorLink, { AnchorLinkProps } from './AnchorLink';
44

components/auto-complete/OptGroup.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { FunctionalComponent } from 'vue';
2-
import { OptionGroupData } from '../vc-select/interface';
1+
import type { FunctionalComponent } from 'vue';
2+
import type { OptionGroupData } from '../vc-select/interface';
33

44
export type OptGroupProps = Omit<OptionGroupData, 'options'>;
55

components/auto-complete/Option.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { FunctionalComponent } from 'vue';
2-
import { OptionCoreData } from '../vc-select/interface';
1+
import type { FunctionalComponent } from 'vue';
2+
import type { OptionCoreData } from '../vc-select/interface';
33

44
export interface OptionProps extends Omit<OptionCoreData, 'label'> {
55
/** Save for customize data */

components/auto-complete/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { App, defineComponent, inject, provide, Plugin, VNode, ExtractPropTypes } from 'vue';
1+
import type { App, Plugin, VNode, ExtractPropTypes } from 'vue';
2+
import { defineComponent, inject, provide } from 'vue';
23
import Select, { SelectProps } from '../select';
34
import Input from '../input';
45
import InputElement from './InputElement';

components/avatar/Avatar.tsx

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import { tuple, VueNode } from '../_util/type';
2-
import {
3-
computed,
4-
CSSProperties,
5-
defineComponent,
6-
ExtractPropTypes,
7-
nextTick,
8-
onMounted,
9-
PropType,
10-
ref,
11-
watch,
12-
} from 'vue';
1+
import type { VueNode } from '../_util/type';
2+
import { tuple } from '../_util/type';
3+
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
4+
import { computed, defineComponent, nextTick, onMounted, ref, watch } from 'vue';
135
import { getPropsSlot } from '../_util/props-util';
146
import PropTypes from '../_util/vue-types';
157
import useBreakpoint from '../_util/hooks/useBreakpoint';
16-
import { Breakpoint, responsiveArray, ScreenSizeMap } from '../_util/responsiveObserve';
8+
import type { Breakpoint, ScreenSizeMap } from '../_util/responsiveObserve';
9+
import { responsiveArray } from '../_util/responsiveObserve';
1710
import useConfigInject from '../_util/hooks/useConfigInject';
1811
import ResizeObserver from '../vc-resize-observer';
1912
import { useInjectSize } from '../_util/hooks/useSize';

components/avatar/Group.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { cloneElement } from '../_util/vnode';
2-
import Avatar, { avatarProps, AvatarSize } from './Avatar';
2+
import type { AvatarSize } from './Avatar';
3+
import Avatar, { avatarProps } from './Avatar';
34
import Popover from '../popover';
4-
import { defineComponent, PropType, ExtractPropTypes, CSSProperties } from 'vue';
5+
import type { PropType, ExtractPropTypes, CSSProperties } from 'vue';
6+
import { defineComponent } from 'vue';
57
import PropTypes from '../_util/vue-types';
68
import { flattenChildren, getPropsSlot } from '../_util/props-util';
79
import { tuple } from '../_util/type';

components/avatar/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, Plugin } from 'vue';
1+
import type { App, Plugin } from 'vue';
22
import Avatar from './Avatar';
33
import Group from './Group';
44

components/back-top/index.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
import type { ExtractPropTypes, PropType } from 'vue';
12
import {
23
defineComponent,
3-
ExtractPropTypes,
44
inject,
55
nextTick,
66
onActivated,
77
onBeforeUnmount,
88
onMounted,
99
reactive,
10-
PropType,
1110
ref,
1211
watch,
1312
onDeactivated,

components/badge/Badge.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import classNames from '../_util/classNames';
44
import { getPropsSlot, flattenChildren } from '../_util/props-util';
55
import { cloneElement } from '../_util/vnode';
66
import { getTransitionProps, Transition } from '../_util/transition';
7-
import { defineComponent, ExtractPropTypes, CSSProperties, computed, ref, watch } from 'vue';
7+
import type { ExtractPropTypes, CSSProperties } from 'vue';
8+
import { defineComponent, computed, ref, watch } from 'vue';
89
import { tuple } from '../_util/type';
910
import Ribbon from './Ribbon';
1011
import { isPresetColor } from './utils';

components/badge/Ribbon.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { LiteralUnion, tuple } from '../_util/type';
2-
import { PresetColorType } from '../_util/colors';
1+
import type { LiteralUnion } from '../_util/type';
2+
import { tuple } from '../_util/type';
3+
import type { PresetColorType } from '../_util/colors';
34
import { isPresetColor } from './utils';
4-
import { CSSProperties, defineComponent, PropType, ExtractPropTypes, computed } from 'vue';
5+
import type { CSSProperties, PropType, ExtractPropTypes } from 'vue';
6+
import { defineComponent, computed } from 'vue';
57
import PropTypes from '../_util/vue-types';
68
import useConfigInject from '../_util/hooks/useConfigInject';
79

components/badge/ScrollNumber.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import classNames from '../_util/classNames';
22
import PropTypes from '../_util/vue-types';
33
import { cloneElement } from '../_util/vnode';
4-
import {
5-
defineComponent,
6-
ExtractPropTypes,
7-
CSSProperties,
8-
DefineComponent,
9-
HTMLAttributes,
10-
} from 'vue';
4+
import type { ExtractPropTypes, CSSProperties, DefineComponent, HTMLAttributes } from 'vue';
5+
import { defineComponent } from 'vue';
116
import useConfigInject from '../_util/hooks/useConfigInject';
127
import SingleNumber from './SingleNumber';
138
import { filterEmpty } from '../_util/props-util';

components/badge/SingleNumber.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { computed, CSSProperties, defineComponent, onUnmounted, reactive, ref, watch } from 'vue';
1+
import type { CSSProperties } from 'vue';
2+
import { computed, defineComponent, onUnmounted, reactive, ref, watch } from 'vue';
23
import classNames from '../_util/classNames';
34

45
export interface UnitNumberProps {

components/badge/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, Plugin } from 'vue';
1+
import type { App, Plugin } from 'vue';
22
import Badge from './Badge';
33
import Ribbon from './Ribbon';
44
export type { BadgeProps } from './Badge';

components/breadcrumb/Breadcrumb.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { cloneVNode, defineComponent, PropType, ExtractPropTypes } from 'vue';
1+
import type { PropType, ExtractPropTypes } from 'vue';
2+
import { cloneVNode, defineComponent } from 'vue';
23
import PropTypes from '../_util/vue-types';
34
import { flattenChildren, getPropsSlot } from '../_util/props-util';
45
import warning from '../_util/warning';
56
import BreadcrumbItem from './BreadcrumbItem';
67
import Menu from '../menu';
7-
import { Omit, VueNode } from '../_util/type';
8+
import type { Omit, VueNode } from '../_util/type';
89
import useConfigInject from '../_util/hooks/useConfigInject';
910

1011
export interface Route {

components/breadcrumb/BreadcrumbItem.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { defineComponent, ExtractPropTypes } from 'vue';
1+
import type { ExtractPropTypes } from 'vue';
2+
import { defineComponent } from 'vue';
23
import PropTypes from '../_util/vue-types';
34
import { getPropsSlot } from '../_util/props-util';
45
import DropDown from '../dropdown/dropdown';

components/breadcrumb/BreadcrumbSeparator.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { defineComponent, ExtractPropTypes } from 'vue';
1+
import type { ExtractPropTypes } from 'vue';
2+
import { defineComponent } from 'vue';
23
import PropTypes from '../_util/vue-types';
34
import { flattenChildren } from '../_util/props-util';
45
import useConfigInject from '../_util/hooks/useConfigInject';

components/breadcrumb/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, Plugin } from 'vue';
1+
import type { App, Plugin } from 'vue';
22
import Breadcrumb from './Breadcrumb';
33
import BreadcrumbItem from './BreadcrumbItem';
44
import BreadcrumbSeparator from './BreadcrumbSeparator';

components/button/button.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { defineComponent, ExtractPropTypes, inject, Text, VNode } from 'vue';
1+
import type { ExtractPropTypes, VNode } from 'vue';
2+
import { defineComponent, inject, Text } from 'vue';
23
import Wave from '../_util/wave';
34
import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined';
45
import buttonTypes from './buttonTypes';

components/button/buttonTypes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ExtractPropTypes } from 'vue';
1+
import type { ExtractPropTypes } from 'vue';
22

33
import { tuple } from '../_util/type';
44
import PropTypes, { withUndefined } from '../_util/vue-types';

components/button/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, Plugin } from 'vue';
1+
import type { App, Plugin } from 'vue';
22
import Button from './button';
33
import ButtonGroup from './button-group';
44
export type { ButtonProps } from './button';

components/calendar/Header.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { defineComponent, inject, PropType } from 'vue';
1+
import type { PropType } from 'vue';
2+
import { defineComponent, inject } from 'vue';
23
import Select from '../select';
34
import { Group, Button } from '../radio';
45
import PropTypes from '../_util/vue-types';
56
import { defaultConfigProvider } from '../config-provider';
6-
import { VueNode } from '../_util/type';
7-
import moment from 'moment';
8-
import { RadioChangeEvent } from '../radio/interface';
7+
import type { VueNode } from '../_util/type';
8+
import type moment from 'moment';
9+
import type { RadioChangeEvent } from '../radio/interface';
910

1011
function getMonthsLocale(value: moment.Moment): string[] {
1112
const current = value.clone();

0 commit comments

Comments
 (0)