From c3c2c157d07ea54cefe441aac159d462cd05d4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Tue, 28 Apr 2020 16:14:38 +0800 Subject: [PATCH] fix: correct Button `type="danger"` TypeScript definition (#23709) * fix: remove Button type danger in TypeScript close #23708 * docs: fix Table dataSource type in document close #23697 * add warning about type="danger" * reverse button type warning logic --- components/button/button.tsx | 8 +++++++- components/table/index.en-US.md | 2 +- components/table/index.zh-CN.md | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/button/button.tsx b/components/button/button.tsx index 84bc381f0f..861032cb33 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -65,7 +65,7 @@ function spaceChildren(children: React.ReactNode, needInserted: boolean) { ); } -const ButtonTypes = tuple('default', 'primary', 'ghost', 'dashed', 'danger', 'link'); +const ButtonTypes = tuple('default', 'primary', 'ghost', 'dashed', 'link'); export type ButtonType = typeof ButtonTypes[number]; const ButtonShapes = tuple('circle', 'circle-outline', 'round'); export type ButtonShape = typeof ButtonShapes[number]; @@ -186,6 +186,12 @@ const Button: ButtonTypeProps = ({ ...props }) => { `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`, ); + warning( + (type as string) !== 'danger', + 'Button', + `\`type="danger"\` is deprecated. Please use \`danger\`.`, + ); + const prefixCls = getPrefixCls('btn', customizePrefixCls); const autoInsertSpace = autoInsertSpaceInButton !== false; diff --git a/components/table/index.en-US.md b/components/table/index.en-US.md index 752ebf9267..ceac93fc12 100644 --- a/components/table/index.en-US.md +++ b/components/table/index.en-US.md @@ -63,7 +63,7 @@ const columns = [ | bordered | Whether to show all table borders | boolean | `false` | | columns | Columns of table | [ColumnProps](#Column)\[] | - | | components | Override default table elements | [TableComponents](https://git.io/fANxz) | - | -| dataSource | Data record array to be displayed | any\[] | - | +| dataSource | Data record array to be displayed | object\[] | - | | expandable | Config expandable content | [expandable](#expandable) | - | | footer | Table footer renderer | Function(currentPageData) | - | | loading | Loading status of table | boolean\|[object](/components/spin/#API) ([more](https://github.com/ant-design/ant-design/issues/4544#issuecomment-271533135)) | `false` | diff --git a/components/table/index.zh-CN.md b/components/table/index.zh-CN.md index 82a38f61e4..7cc5e7aa57 100644 --- a/components/table/index.zh-CN.md +++ b/components/table/index.zh-CN.md @@ -68,7 +68,7 @@ const columns = [ | bordered | 是否展示外边框和列边框 | boolean | false | | columns | 表格列的配置描述,具体项见下表 | [ColumnProps](#Column)\[] | - | | components | 覆盖默认的 table 元素 | [TableComponents](https://git.io/fANxz) | - | -| dataSource | 数据数组 | any\[] | - | +| dataSource | 数据数组 | object\[] | - | | expandable | 配置展开属性 | [expandable](#expandable) | - | | footer | 表格尾部 | Function(currentPageData) | - | | loading | 页面是否加载中 | boolean\|[object](/components/spin/#API) ([更多](https://github.com/ant-design/ant-design/issues/4544#issuecomment-271533135)) | false |