Browse Source

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
pull/23713/head
偏右 5 years ago
committed by GitHub
parent
commit
c3c2c157d0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      components/button/button.tsx
  2. 2
      components/table/index.en-US.md
  3. 2
      components/table/index.zh-CN.md

8
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;

2
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` |

2
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 |

Loading…
Cancel
Save