Skip to content

chore: use type import #4260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"rules": {
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/ban-types": 0,
"@typescript-eslint/consistent-type-imports": 1,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-non-null-assertion": 0,
Expand Down
3 changes: 2 additions & 1 deletion components/_util/colors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ElementOf, tuple } from './type';
import type { ElementOf } from './type';
import { tuple } from './type';

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

Expand Down
6 changes: 4 additions & 2 deletions components/_util/hooks/useBreakpoint.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { onMounted, onUnmounted, Ref, ref } from 'vue';
import ResponsiveObserve, { ScreenMap } from '../../_util/responsiveObserve';
import type { Ref } from 'vue';
import { onMounted, onUnmounted, ref } from 'vue';
import type { ScreenMap } from '../../_util/responsiveObserve';
import ResponsiveObserve from '../../_util/responsiveObserve';

function useBreakpoint(): Ref<ScreenMap> {
const screens = ref<ScreenMap>({});
Expand Down
13 changes: 5 additions & 8 deletions components/_util/hooks/useConfigInject.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { RequiredMark } from '../../form/Form';
import { computed, ComputedRef, inject, UnwrapRef, VNodeChild } from 'vue';
import {
ConfigProviderProps,
defaultConfigProvider,
Direction,
SizeType,
} from '../../config-provider';
import type { RequiredMark } from '../../form/Form';
import type { ComputedRef, UnwrapRef, VNodeChild } from 'vue';
import { computed, inject } from 'vue';
import type { ConfigProviderProps, Direction, SizeType } from '../../config-provider';
import { defaultConfigProvider } from '../../config-provider';

export default (
name: string,
Expand Down
3 changes: 2 additions & 1 deletion components/_util/hooks/useMemo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Ref, ref, watch } from 'vue';
import type { Ref } from 'vue';
import { ref, watch } from 'vue';

export default function useMemo<T>(
getValue: () => T,
Expand Down
3 changes: 2 additions & 1 deletion components/_util/hooks/usePrefixCls.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { computed, ComputedRef, inject } from 'vue';
import type { ComputedRef } from 'vue';
import { computed, inject } from 'vue';
import { defaultConfigProvider } from '../../config-provider';

export default (name: string, props: Record<any, any>): ComputedRef<string> => {
Expand Down
3 changes: 2 additions & 1 deletion components/_util/hooks/useRef.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { onBeforeUpdate, ref, Ref } from 'vue';
import type { Ref } from 'vue';
import { onBeforeUpdate, ref } from 'vue';

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

Expand Down
6 changes: 4 additions & 2 deletions components/_util/hooks/useSize.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { computed, ComputedRef, inject, provide, UnwrapRef } from 'vue';
import { ConfigProviderProps, defaultConfigProvider, SizeType } from '../../config-provider';
import type { ComputedRef, UnwrapRef } from 'vue';
import { computed, inject, provide } from 'vue';
import type { ConfigProviderProps, SizeType } from '../../config-provider';
import { defaultConfigProvider } from '../../config-provider';

const sizeProvider = Symbol('SizeProvider');

Expand Down
4 changes: 2 additions & 2 deletions components/_util/props-util/initDefaultProps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PropType } from 'vue';
import { VueTypeValidableDef, VueTypeDef } from 'vue-types';
import type { PropType } from 'vue';
import type { VueTypeValidableDef, VueTypeDef } from 'vue-types';

const initDefaultProps = <T>(
types: T,
Expand Down
2 changes: 1 addition & 1 deletion components/_util/setStyle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CSSProperties } from 'vue';
import type { CSSProperties } from 'vue';

/**
* Easy to set element style, return previous style
Expand Down
3 changes: 2 additions & 1 deletion components/_util/transButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineComponent, CSSProperties, ref, onMounted } from 'vue';
import type { CSSProperties } from 'vue';
import { defineComponent, ref, onMounted } from 'vue';
/**
* Wrap of sub component which need use as Button capacity (like Icon component).
* This helps accessibility reader to tread as a interactive button to operation.
Expand Down
11 changes: 2 additions & 9 deletions components/_util/transition.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import {
BaseTransitionProps,
CSSProperties,
defineComponent,
nextTick,
Ref,
Transition as T,
TransitionGroup as TG,
} from 'vue';
import type { BaseTransitionProps, CSSProperties, Ref } from 'vue';
import { defineComponent, nextTick, Transition as T, TransitionGroup as TG } from 'vue';
import { findDOMNode } from './props-util';

export const getTransitionProps = (transitionName: string, opt: object = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion components/_util/type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, PropType, VNodeChild, Plugin } from 'vue';
import type { App, PropType, VNodeChild, Plugin } from 'vue';

export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
Expand Down
7 changes: 4 additions & 3 deletions components/_util/vue-types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CSSProperties } from 'vue';
import { createTypes, VueTypeValidableDef, VueTypesInterface } from 'vue-types';
import { VueNode } from '../type';
import type { CSSProperties } from 'vue';
import type { VueTypeValidableDef, VueTypesInterface } from 'vue-types';
import { createTypes } from 'vue-types';
import type { VueNode } from '../type';
const PropTypes = createTypes({
func: undefined,
bool: undefined,
Expand Down
3 changes: 1 addition & 2 deletions components/affix/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CSSProperties, ExtractPropTypes } from 'vue';
import {
CSSProperties,
defineComponent,
ref,
reactive,
Expand All @@ -9,7 +9,6 @@ import {
computed,
onUnmounted,
onUpdated,
ExtractPropTypes,
} from 'vue';
import PropTypes from '../_util/vue-types';
import classNames from '../_util/classNames';
Expand Down
2 changes: 1 addition & 1 deletion components/affix/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import addEventListener from '../vc-util/Dom/addEventListener';
import { ComponentPublicInstance } from 'vue';
import type { ComponentPublicInstance } from 'vue';
import supportsPassive from '../_util/supportsPassive';

export type BindElement = HTMLElement | Window | null | undefined;
Expand Down
3 changes: 2 additions & 1 deletion components/alert/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { inject, cloneVNode, defineComponent, ref, ExtractPropTypes } from 'vue';
import type { ExtractPropTypes } from 'vue';
import { inject, cloneVNode, defineComponent, ref } from 'vue';
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import CheckCircleOutlined from '@ant-design/icons-vue/CheckCircleOutlined';
import ExclamationCircleOutlined from '@ant-design/icons-vue/ExclamationCircleOutlined';
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/Anchor.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ExtractPropTypes } from 'vue';
import {
defineComponent,
nextTick,
Expand All @@ -6,7 +7,6 @@ import {
onUpdated,
reactive,
ref,
ExtractPropTypes,
computed,
} from 'vue';
import PropTypes from '../_util/vue-types';
Expand Down
10 changes: 2 additions & 8 deletions components/anchor/AnchorLink.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import {
defineComponent,
ExtractPropTypes,
nextTick,
onBeforeUnmount,
onMounted,
watch,
} from 'vue';
import type { ExtractPropTypes } from 'vue';
import { defineComponent, nextTick, onBeforeUnmount, onMounted, watch } from 'vue';
import PropTypes from '../_util/vue-types';
import { getPropsSlot } from '../_util/props-util';
import classNames from '../_util/classNames';
Expand Down
3 changes: 2 additions & 1 deletion components/anchor/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { computed, Ref, inject, InjectionKey, provide } from 'vue';
import type { Ref, InjectionKey } from 'vue';
import { computed, inject, provide } from 'vue';

export interface AnchorContext {
registerLink: (link: string) => void;
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Plugin } from 'vue';
import type { App, Plugin } from 'vue';
import Anchor, { AnchorProps } from './Anchor';
import AnchorLink, { AnchorLinkProps } from './AnchorLink';

Expand Down
4 changes: 2 additions & 2 deletions components/auto-complete/OptGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FunctionalComponent } from 'vue';
import { OptionGroupData } from '../vc-select/interface';
import type { FunctionalComponent } from 'vue';
import type { OptionGroupData } from '../vc-select/interface';

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

Expand Down
4 changes: 2 additions & 2 deletions components/auto-complete/Option.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FunctionalComponent } from 'vue';
import { OptionCoreData } from '../vc-select/interface';
import type { FunctionalComponent } from 'vue';
import type { OptionCoreData } from '../vc-select/interface';

export interface OptionProps extends Omit<OptionCoreData, 'label'> {
/** Save for customize data */
Expand Down
3 changes: 2 additions & 1 deletion components/auto-complete/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { App, defineComponent, inject, provide, Plugin, VNode, ExtractPropTypes } from 'vue';
import type { App, Plugin, VNode, ExtractPropTypes } from 'vue';
import { defineComponent, inject, provide } from 'vue';
import Select, { SelectProps } from '../select';
import Input from '../input';
import InputElement from './InputElement';
Expand Down
19 changes: 6 additions & 13 deletions components/avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import { tuple, VueNode } from '../_util/type';
import {
computed,
CSSProperties,
defineComponent,
ExtractPropTypes,
nextTick,
onMounted,
PropType,
ref,
watch,
} from 'vue';
import type { VueNode } from '../_util/type';
import { tuple } from '../_util/type';
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
import { computed, defineComponent, nextTick, onMounted, ref, watch } from 'vue';
import { getPropsSlot } from '../_util/props-util';
import PropTypes from '../_util/vue-types';
import useBreakpoint from '../_util/hooks/useBreakpoint';
import { Breakpoint, responsiveArray, ScreenSizeMap } from '../_util/responsiveObserve';
import type { Breakpoint, ScreenSizeMap } from '../_util/responsiveObserve';
import { responsiveArray } from '../_util/responsiveObserve';
import useConfigInject from '../_util/hooks/useConfigInject';
import ResizeObserver from '../vc-resize-observer';
import { useInjectSize } from '../_util/hooks/useSize';
Expand Down
6 changes: 4 additions & 2 deletions components/avatar/Group.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { cloneElement } from '../_util/vnode';
import Avatar, { avatarProps, AvatarSize } from './Avatar';
import type { AvatarSize } from './Avatar';
import Avatar, { avatarProps } from './Avatar';
import Popover from '../popover';
import { defineComponent, PropType, ExtractPropTypes, CSSProperties } from 'vue';
import type { PropType, ExtractPropTypes, CSSProperties } from 'vue';
import { defineComponent } from 'vue';
import PropTypes from '../_util/vue-types';
import { flattenChildren, getPropsSlot } from '../_util/props-util';
import { tuple } from '../_util/type';
Expand Down
2 changes: 1 addition & 1 deletion components/avatar/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Plugin } from 'vue';
import type { App, Plugin } from 'vue';
import Avatar from './Avatar';
import Group from './Group';

Expand Down
3 changes: 1 addition & 2 deletions components/back-top/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import type { ExtractPropTypes, PropType } from 'vue';
import {
defineComponent,
ExtractPropTypes,
inject,
nextTick,
onActivated,
onBeforeUnmount,
onMounted,
reactive,
PropType,
ref,
watch,
onDeactivated,
Expand Down
3 changes: 2 additions & 1 deletion components/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import classNames from '../_util/classNames';
import { getPropsSlot, flattenChildren } from '../_util/props-util';
import { cloneElement } from '../_util/vnode';
import { getTransitionProps, Transition } from '../_util/transition';
import { defineComponent, ExtractPropTypes, CSSProperties, computed, ref, watch } from 'vue';
import type { ExtractPropTypes, CSSProperties } from 'vue';
import { defineComponent, computed, ref, watch } from 'vue';
import { tuple } from '../_util/type';
import Ribbon from './Ribbon';
import { isPresetColor } from './utils';
Expand Down
8 changes: 5 additions & 3 deletions components/badge/Ribbon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { LiteralUnion, tuple } from '../_util/type';
import { PresetColorType } from '../_util/colors';
import type { LiteralUnion } from '../_util/type';
import { tuple } from '../_util/type';
import type { PresetColorType } from '../_util/colors';
import { isPresetColor } from './utils';
import { CSSProperties, defineComponent, PropType, ExtractPropTypes, computed } from 'vue';
import type { CSSProperties, PropType, ExtractPropTypes } from 'vue';
import { defineComponent, computed } from 'vue';
import PropTypes from '../_util/vue-types';
import useConfigInject from '../_util/hooks/useConfigInject';

Expand Down
9 changes: 2 additions & 7 deletions components/badge/ScrollNumber.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import classNames from '../_util/classNames';
import PropTypes from '../_util/vue-types';
import { cloneElement } from '../_util/vnode';
import {
defineComponent,
ExtractPropTypes,
CSSProperties,
DefineComponent,
HTMLAttributes,
} from 'vue';
import type { ExtractPropTypes, CSSProperties, DefineComponent, HTMLAttributes } from 'vue';
import { defineComponent } from 'vue';
import useConfigInject from '../_util/hooks/useConfigInject';
import SingleNumber from './SingleNumber';
import { filterEmpty } from '../_util/props-util';
Expand Down
3 changes: 2 additions & 1 deletion components/badge/SingleNumber.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { computed, CSSProperties, defineComponent, onUnmounted, reactive, ref, watch } from 'vue';
import type { CSSProperties } from 'vue';
import { computed, defineComponent, onUnmounted, reactive, ref, watch } from 'vue';
import classNames from '../_util/classNames';

export interface UnitNumberProps {
Expand Down
2 changes: 1 addition & 1 deletion components/badge/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Plugin } from 'vue';
import type { App, Plugin } from 'vue';
import Badge from './Badge';
import Ribbon from './Ribbon';
export type { BadgeProps } from './Badge';
Expand Down
5 changes: 3 additions & 2 deletions components/breadcrumb/Breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { cloneVNode, defineComponent, PropType, ExtractPropTypes } from 'vue';
import type { PropType, ExtractPropTypes } from 'vue';
import { cloneVNode, defineComponent } from 'vue';
import PropTypes from '../_util/vue-types';
import { flattenChildren, getPropsSlot } from '../_util/props-util';
import warning from '../_util/warning';
import BreadcrumbItem from './BreadcrumbItem';
import Menu from '../menu';
import { Omit, VueNode } from '../_util/type';
import type { Omit, VueNode } from '../_util/type';
import useConfigInject from '../_util/hooks/useConfigInject';

export interface Route {
Expand Down
3 changes: 2 additions & 1 deletion components/breadcrumb/BreadcrumbItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineComponent, ExtractPropTypes } from 'vue';
import type { ExtractPropTypes } from 'vue';
import { defineComponent } from 'vue';
import PropTypes from '../_util/vue-types';
import { getPropsSlot } from '../_util/props-util';
import DropDown from '../dropdown/dropdown';
Expand Down
3 changes: 2 additions & 1 deletion components/breadcrumb/BreadcrumbSeparator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineComponent, ExtractPropTypes } from 'vue';
import type { ExtractPropTypes } from 'vue';
import { defineComponent } from 'vue';
import PropTypes from '../_util/vue-types';
import { flattenChildren } from '../_util/props-util';
import useConfigInject from '../_util/hooks/useConfigInject';
Expand Down
2 changes: 1 addition & 1 deletion components/breadcrumb/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Plugin } from 'vue';
import type { App, Plugin } from 'vue';
import Breadcrumb from './Breadcrumb';
import BreadcrumbItem from './BreadcrumbItem';
import BreadcrumbSeparator from './BreadcrumbSeparator';
Expand Down
3 changes: 2 additions & 1 deletion components/button/button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineComponent, ExtractPropTypes, inject, Text, VNode } from 'vue';
import type { ExtractPropTypes, VNode } from 'vue';
import { defineComponent, inject, Text } from 'vue';
import Wave from '../_util/wave';
import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined';
import buttonTypes from './buttonTypes';
Expand Down
2 changes: 1 addition & 1 deletion components/button/buttonTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExtractPropTypes } from 'vue';
import type { ExtractPropTypes } from 'vue';

import { tuple } from '../_util/type';
import PropTypes, { withUndefined } from '../_util/vue-types';
Expand Down
2 changes: 1 addition & 1 deletion components/button/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Plugin } from 'vue';
import type { App, Plugin } from 'vue';
import Button from './button';
import ButtonGroup from './button-group';
export type { ButtonProps } from './button';
Expand Down
9 changes: 5 additions & 4 deletions components/calendar/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { defineComponent, inject, PropType } from 'vue';
import type { PropType } from 'vue';
import { defineComponent, inject } from 'vue';
import Select from '../select';
import { Group, Button } from '../radio';
import PropTypes from '../_util/vue-types';
import { defaultConfigProvider } from '../config-provider';
import { VueNode } from '../_util/type';
import moment from 'moment';
import { RadioChangeEvent } from '../radio/interface';
import type { VueNode } from '../_util/type';
import type moment from 'moment';
import type { RadioChangeEvent } from '../radio/interface';

function getMonthsLocale(value: moment.Moment): string[] {
const current = value.clone();
Expand Down
Loading