From de82a15b22eab4fb05629740639eec55f691e0b3 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Fri, 17 Feb 2023 22:11:06 +0800 Subject: [PATCH] type: simplify getPlacement return type (#40775) --- components/select/index.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/select/index.tsx b/components/select/index.tsx index fdc91fa358..fe28f1dfde 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -1,7 +1,7 @@ // TODO: 4.0 - codemod should help to change `filterOption` to support node props. import classNames from 'classnames'; +import type { BaseSelectRef, SelectProps as RcSelectProps } from 'rc-select'; import RcSelect, { OptGroup, Option } from 'rc-select'; -import type { SelectProps as RcSelectProps, BaseSelectRef } from 'rc-select'; import type { OptionProps } from 'rc-select/lib/Option'; import type { BaseOptionType, DefaultOptionType } from 'rc-select/lib/Select'; import omit from 'rc-util/lib/omit'; @@ -18,10 +18,10 @@ import type { InputStatus } from '../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils'; import getIcons from './utils/iconUtil'; -import useStyle from './style'; +import { useCompactItemContext } from '../space/Compact'; import genPurePanel from '../_util/PurePanel'; import warning from '../_util/warning'; -import { useCompactItemContext } from '../space/Compact'; +import useStyle from './style'; type RawValue = string | number; @@ -182,13 +182,11 @@ const InternalSelect = { + const getPlacement = (): SelectCommonPlacement => { if (placement !== undefined) { return placement; } - return direction === 'rtl' - ? ('bottomRight' as SelectCommonPlacement) - : ('bottomLeft' as SelectCommonPlacement); + return direction === 'rtl' ? 'bottomRight' : 'bottomLeft'; }; // ====================== Warning ======================