From 901916777882fb2a7a1275b9f268f0aa08ffb2de Mon Sep 17 00:00:00 2001 From: "mario.gk" Date: Fri, 22 Mar 2024 14:29:00 +0800 Subject: [PATCH] chore(SplitButton): fix ts problems --- components/split-button/__docs__/adaptor/index.tsx | 2 -- components/split-button/__docs__/theme/index.tsx | 1 - components/split-button/index.tsx | 4 ++-- components/split-button/types.ts | 4 ---- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/components/split-button/__docs__/adaptor/index.tsx b/components/split-button/__docs__/adaptor/index.tsx index 75263ee983..5a70d2827f 100644 --- a/components/split-button/__docs__/adaptor/index.tsx +++ b/components/split-button/__docs__/adaptor/index.tsx @@ -1,4 +1,3 @@ -/* eslint-disable no-use-before-define */ import React from 'react'; import { SplitButton, Menu, Icon } from '@alifd/next'; import { Types, parseData, ContentType } from '@alifd/adaptor-helper'; @@ -30,7 +29,6 @@ const createDataSouce = ( list.forEach(item => { switch (item.type) { - // eslint-disable-next-line no-case-declarations case 'node': key = `${prefix || level}-${index++}`; if (item.children && item.children.length > 0) { diff --git a/components/split-button/__docs__/theme/index.tsx b/components/split-button/__docs__/theme/index.tsx index b23f4d616b..d706a951f2 100644 --- a/components/split-button/__docs__/theme/index.tsx +++ b/components/split-button/__docs__/theme/index.tsx @@ -6,7 +6,6 @@ import ConfigProvider from '../../../config-provider'; import '../../../demo-helper/style'; import '../../style'; -/* eslint-disable */ const i18nMap = { 'zh-cn': { splitButton: '分隔下拉按钮', diff --git a/components/split-button/index.tsx b/components/split-button/index.tsx index b41b573f0e..aa75db9c41 100644 --- a/components/split-button/index.tsx +++ b/components/split-button/index.tsx @@ -104,7 +104,7 @@ class SplitButton extends React.Component { this.props.onSelect && this.props.onSelect(keys, ...others); }; - clickMenuItem = (key: string, ...others: [MenuItem, React.MouseEvent]) => { + clickMenuItem: MenuProps['onItemClick'] = (key, ...others) => { this.props.onItemClick && this.props.onItemClick(key, ...others); this.onVisibleChange(false, 'menuSelect'); }; @@ -117,7 +117,7 @@ class SplitButton extends React.Component { } }; - onVisibleChange = (visible: boolean, reason: 'menuSelect' | 'fromTrigger' | 'docClick') => { + onVisibleChange: NonNullable = (visible, reason) => { if (!('visible' in this.props)) { this.setState({ visible, diff --git a/components/split-button/types.ts b/components/split-button/types.ts index 047bd318fb..386ab56d55 100644 --- a/components/split-button/types.ts +++ b/components/split-button/types.ts @@ -31,14 +31,12 @@ export interface SplitButtonProps extends Omit, CommonP /** * 设置标签类型 * @en The html tag to be rendered - * @defaultValue 'button' */ component?: 'button' | 'a'; /** * 是否为幽灵按钮 * @en Setting ghost button - * @defaultValue false */ ghost?: 'light' | 'dark' | false | true; @@ -63,7 +61,6 @@ export interface SplitButtonProps extends Omit, CommonP /** * 菜单的选择模式 * @en The select mode of menu - * @defaultValue 'single' */ selectMode?: 'single' | 'multiple'; @@ -122,7 +119,6 @@ export interface SplitButtonProps extends Omit, CommonP /** * 弹层对齐方式, 详情见 Overlay align * @en Align of popup, @see Overlay doc for detail - * @defaultValue 'tl bl' */ popupAlign?: string;