diff --git a/components/dropdown/dropdown-button.tsx b/components/dropdown/dropdown-button.tsx
index 3a90d26b10..225aa1ae6a 100644
--- a/components/dropdown/dropdown-button.tsx
+++ b/components/dropdown/dropdown-button.tsx
@@ -70,7 +70,7 @@ const DropdownButton: DropdownButtonInterface = props => {
} = props;
const prefixCls = getPrefixCls('dropdown-button', customizePrefixCls);
- const dropdownProps = {
+ const dropdownProps: DropdownProps = {
align,
overlay,
disabled,
@@ -82,7 +82,7 @@ const DropdownButton: DropdownButtonInterface = props => {
overlayClassName,
overlayStyle,
destroyPopupOnHide,
- } as DropdownProps;
+ };
if ('open' in props) {
dropdownProps.open = open;
@@ -113,7 +113,7 @@ const DropdownButton: DropdownButtonInterface = props => {
const rightButton = ;
- const [leftButtonToRender, rightButtonToRender] = buttonsRender!([leftButton, rightButton]);
+ const [leftButtonToRender, rightButtonToRender] = buttonsRender([leftButton, rightButton]);
return (
diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx
index bf3ef5bc1f..f14096e14a 100644
--- a/components/dropdown/dropdown.tsx
+++ b/components/dropdown/dropdown.tsx
@@ -109,7 +109,7 @@ const Dropdown: DropdownInterface = props => {
if (transitionName !== undefined) {
return transitionName;
}
- if (placement.indexOf('top') >= 0) {
+ if (placement.includes('top')) {
return `${rootPrefixCls}-slide-down`;
}
return `${rootPrefixCls}-slide-up`;
@@ -118,7 +118,7 @@ const Dropdown: DropdownInterface = props => {
const getPlacement = () => {
const { placement } = props;
if (!placement) {
- return direction === 'rtl' ? ('bottomRight' as Placement) : ('bottomLeft' as Placement);
+ return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
}
if (placement.includes('Center')) {
@@ -146,6 +146,8 @@ const Dropdown: DropdownInterface = props => {
open,
onVisibleChange,
onOpenChange,
+ mouseEnterDelay = 0.15,
+ mouseLeaveDelay = 0.1,
} = props;
const prefixCls = getPrefixCls('dropdown', customizePrefixCls);
@@ -163,8 +165,8 @@ const Dropdown: DropdownInterface = props => {
});
const triggerActions = disabled ? [] : trigger;
- let alignPoint;
- if (triggerActions && triggerActions.indexOf('contextMenu') !== -1) {
+ let alignPoint: boolean;
+ if (triggerActions && triggerActions.includes('contextMenu')) {
alignPoint = true;
}
@@ -198,9 +200,9 @@ const Dropdown: DropdownInterface = props => {
// So we need render the element to check and pass back to rc-dropdown.
const { overlay } = props;
- let overlayNode;
+ let overlayNode: React.ReactNode;
if (typeof overlay === 'function') {
- overlayNode = (overlay as OverlayFunc)();
+ overlayNode = overlay();
} else {
overlayNode = overlay;
}
@@ -236,8 +238,10 @@ const Dropdown: DropdownInterface = props => {
// ============================ Render ============================
return (
{
Dropdown.Button = DropdownButton;
-Dropdown.defaultProps = {
- mouseEnterDelay: 0.15,
- mouseLeaveDelay: 0.1,
-};
-
export default Dropdown;