From 973abb6e56329d6bf74bb6068e9034535fc21095 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Sat, 14 Jan 2023 19:30:26 +0800 Subject: [PATCH 01/10] test: add test case for en-US blog to avoid omission in translation (#40231) --- components/__tests__/blog.test.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 components/__tests__/blog.test.ts diff --git a/components/__tests__/blog.test.ts b/components/__tests__/blog.test.ts new file mode 100644 index 0000000000..987ed3a950 --- /dev/null +++ b/components/__tests__/blog.test.ts @@ -0,0 +1,27 @@ +const fs = require('fs'); + +const path = require('path'); + +const blogList = [ + 'check-conduct', + 'css-in-js', + 'getContainer', + 'modal-hook-order', + 'render-times', + 'testing-migrate', + 'to-be-collaborator', +].map((blogName) => path.join(__dirname, `../../docs/blog/${blogName}.en-US.md`)); + +describe('blog', () => { + it('should not include Chinese in en-US blog', () => { + blogList.forEach((blog) => { + fs.readFile(blog, (err: NodeJS.ErrnoException | null, data: Buffer) => { + if (err) { + return; + } + const includeChinese = /[\u4E00-\u9FA5]/.test(data.toString()); + expect(includeChinese).toBe(false); + }); + }); + }); +}); From 5b9f19fc020b152ee02ef611788908f7e67c1430 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Sat, 14 Jan 2023 19:32:38 +0800 Subject: [PATCH 02/10] docs: add contribution guide (#40222) * docs: add contribution guide * fix * fix --- docs/react/contributing.en-US.md | 5 ++++- docs/react/contributing.zh-CN.md | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/react/contributing.en-US.md b/docs/react/contributing.en-US.md index 56f5457f48..e23f74e695 100644 --- a/docs/react/contributing.en-US.md +++ b/docs/react/contributing.en-US.md @@ -50,7 +50,6 @@ The core team is monitoring for pull requests. We will review your pull request 1. Fork the repository and create your branch from the [correct branch](#branch-organization). 1. Run `npm install` in the repository root. - > For Windows 10 development environment, if you run into error `gyp err! find vs msvs_version not set from command line or npm config`, please install [the latest Python v3](https://www.python.org/downloads/) and **Desktop development with C++** through [Visual Studio Installer](https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2019#step-3---install-the-visual-studio-installer) before running `npm install` 1. If you've fixed a bug or added code that should be tested, add tests! 1. Ensure the test suite passes (npm run test). Tip: `npm test -- --watch TestName` is helpful in development. 1. Run `npm test -- -u` to update the [jest snapshots](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) and commit these changes as well (if there are any updates). @@ -79,3 +78,7 @@ After cloning antd, run `npm install` to fetch its dependencies. Then, you can r ## Being a collaborator If you are an active contributor and are willing to work with Ant Design Team in our opensource workflow, you can [apply to be a outside collaborator](https://github.com/ant-design/ant-design/wiki/Collaborators#how-to-apply-for-being-a-collaborator). + +You can also refer to the following contribution guide to become an antd contributor: + +- [How to Grow as a Collaborator](/docs/blog/to-be-collaborator) diff --git a/docs/react/contributing.zh-CN.md b/docs/react/contributing.zh-CN.md index 2d4c454c1c..8f9cb1a237 100644 --- a/docs/react/contributing.zh-CN.md +++ b/docs/react/contributing.zh-CN.md @@ -50,7 +50,6 @@ Ant Design 团队会关注所有的 pull request,我们会 review 以及合并 1. 基于 [正确的分支](#分支管理) 做修改。 1. 在项目根目录下运行了 `npm install`。 - > 在 Windows 10 开发环境下,如果出现 `gyp err! find vs msvs_version not set from command line or npm config`错误, 请在运行 `npm install` 前安装 [最新版 Python v3](https://www.python.org/downloads/), 并通过 [Visual Studio Installer](https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2019#step-3---install-the-visual-studio-installer) 安装 **Desktop development with C++**。 1. 如果你修复了一个 bug 或者新增了一个功能,请确保写了相应的测试,这很重要。 1. 确认所有的测试都是通过的 `npm run test`。 小贴士:开发过程中可以用 `npm test -- --watch TestName` 来运行指定的测试。 1. 运行 `npm test -- -u` 来更新 [jest snapshot](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) 并且把这些更新也提交上来(如果有的话)。 @@ -80,7 +79,8 @@ Ant Design 团队会关注所有的 pull request,我们会 review 以及合并 如果你贡献度足够活跃,希望和 Ant Design 团队一起参与维护工作,你可以[申请成为社区协作者](https://github.com/ant-design/ant-design/wiki/Collaborators#how-to-apply-for-being-a-collaborator)。 -你还可以参考下面两篇社区成员写的贡献指南,一步一步成为 antd 的贡献者吧: +你还可以参考下面三篇社区成员写的贡献指南,一步一步成为 antd 的贡献者吧: - [记录向:如何快速的成为 Ant Design 的 contributor](https://zhuanlan.zhihu.com/p/123367842) [@Rustin-Liu](https://github.com/Rustin-Liu) - [从 0 开始,成为 Ant-Design Contributor](https://zhuanlan.zhihu.com/p/143895612) [@fireairforce](https://github.com/fireairforce) +- [如何成长为 Collaborator](/docs/blog/to-be-collaborator-cn) From 5fa7baa786ee8120f7940c0af1d14fe5a5b1e055 Mon Sep 17 00:00:00 2001 From: puxiao Date: Sat, 14 Jan 2023 19:33:48 +0800 Subject: [PATCH 03/10] docs: Update Image index.zh-CN.md (#40233) --- components/image/index.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/image/index.zh-CN.md b/components/image/index.zh-CN.md index 962ca0b676..d7120f76b2 100644 --- a/components/image/index.zh-CN.md +++ b/components/image/index.zh-CN.md @@ -12,7 +12,7 @@ cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*FbOCS6aFMeUAAAAAAA ## 何时使用 - 需要展示图片时使用。 -- 加载大图时显示 loading 或加载失败时容错处理。 +- 加载显示大图或加载失败时容错处理。 ## 代码演示 From 546bda457f3724092edd01f8778d738deecc95de Mon Sep 17 00:00:00 2001 From: Jimmy <1064425721@qq.com> Date: Sun, 15 Jan 2023 13:08:09 +0800 Subject: [PATCH 04/10] demo : Tabs `onEdit` Callback parameter type problem (#39926) * fix : Tabs`onEdit`Callback parameter type problem * fix : Tabs onEdit Callback parameter type problem --- components/tabs/demo/custom-add-trigger.tsx | 6 ++++-- components/tabs/demo/editable-card.tsx | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/components/tabs/demo/custom-add-trigger.tsx b/components/tabs/demo/custom-add-trigger.tsx index 60af9c051b..7eb5f16692 100644 --- a/components/tabs/demo/custom-add-trigger.tsx +++ b/components/tabs/demo/custom-add-trigger.tsx @@ -1,6 +1,8 @@ import React, { useRef, useState } from 'react'; import { Button, Tabs } from 'antd'; +type TargetKey = React.MouseEvent | React.KeyboardEvent | string; + const defaultPanes = new Array(2).fill(null).map((_, index) => { const id = String(index + 1); return { label: `Tab ${id}`, children: `Content of Tab Pane ${index + 1}`, key: id }; @@ -21,7 +23,7 @@ const App: React.FC = () => { setActiveKey(newActiveKey); }; - const remove = (targetKey: string) => { + const remove = (targetKey: TargetKey) => { const targetIndex = items.findIndex((pane) => pane.key === targetKey); const newPanes = items.filter((pane) => pane.key !== targetKey); if (newPanes.length && targetKey === activeKey) { @@ -31,7 +33,7 @@ const App: React.FC = () => { setItems(newPanes); }; - const onEdit = (targetKey: string, action: 'add' | 'remove') => { + const onEdit = (targetKey: TargetKey, action: 'add' | 'remove') => { if (action === 'add') { add(); } else { diff --git a/components/tabs/demo/editable-card.tsx b/components/tabs/demo/editable-card.tsx index 98f94cfd5e..92027c86cf 100644 --- a/components/tabs/demo/editable-card.tsx +++ b/components/tabs/demo/editable-card.tsx @@ -1,6 +1,8 @@ import React, { useRef, useState } from 'react'; import { Tabs } from 'antd'; +type TargetKey = React.MouseEvent | React.KeyboardEvent | string; + const initialItems = [ { label: 'Tab 1', children: 'Content of Tab 1', key: '1' }, { label: 'Tab 2', children: 'Content of Tab 2', key: '2' }, @@ -29,7 +31,7 @@ const App: React.FC = () => { setActiveKey(newActiveKey); }; - const remove = (targetKey: string) => { + const remove = (targetKey: TargetKey) => { let newActiveKey = activeKey; let lastIndex = -1; items.forEach((item, i) => { @@ -49,7 +51,10 @@ const App: React.FC = () => { setActiveKey(newActiveKey); }; - const onEdit = (targetKey: string, action: 'add' | 'remove') => { + const onEdit = ( + targetKey: React.MouseEvent | React.KeyboardEvent | string, + action: 'add' | 'remove', + ) => { if (action === 'add') { add(); } else { From dfa207253e335cf3d6d5cd3b5f219d90283d5eb7 Mon Sep 17 00:00:00 2001 From: Danial Soheili <33312687+ds1371dani@users.noreply.github.com> Date: Sun, 15 Jan 2023 11:00:16 +0330 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=92=84=20STYLE:=20fix=20DatePicker'?= =?UTF-8?q?s=20next=20&=20prev=20icons=20in=20rtl=20mode=20(#40238)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/date-picker/style/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/date-picker/style/index.ts b/components/date-picker/style/index.ts index 87a4f78734..302c07c405 100644 --- a/components/date-picker/style/index.ts +++ b/components/date-picker/style/index.ts @@ -352,12 +352,12 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => { [`${componentCls}-prev-icon, ${componentCls}-super-prev-icon`]: { - transform: 'rotate(135deg)', + transform: 'rotate(45deg)', }, [`${componentCls}-next-icon, ${componentCls}-super-next-icon`]: { - transform: 'rotate(-45deg)', + transform: 'rotate(-135deg)', }, }, }, From bc32f1444d95936ae58c92a392dc59d74327bda7 Mon Sep 17 00:00:00 2001 From: JarvisArt <38420763+JarvisArt@users.noreply.github.com> Date: Sun, 15 Jan 2023 19:46:42 +0800 Subject: [PATCH 06/10] demo: calendar demo supports dark mode (#40239) --- .../__snapshots__/demo-extend.test.ts.snap | 4 ++-- .../__tests__/__snapshots__/demo.test.ts.snap | 4 ++-- components/calendar/demo/card.md | 14 -------------- components/calendar/demo/card.tsx | 12 ++++++++++-- components/calendar/demo/customize-header.md | 14 -------------- components/calendar/demo/customize-header.tsx | 14 +++++++++++--- 6 files changed, 25 insertions(+), 37 deletions(-) diff --git a/components/calendar/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/calendar/__tests__/__snapshots__/demo-extend.test.ts.snap index 8d312f123a..ffebd62228 100644 --- a/components/calendar/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/calendar/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -1584,7 +1584,7 @@ exports[`renders ./components/calendar/demo/basic.tsx extend context correctly 1 exports[`renders ./components/calendar/demo/card.tsx extend context correctly 1`] = `
- [data-theme="dark"] .site-calendar-demo-card { - border: 1px solid #303030; - } - diff --git a/components/calendar/demo/card.tsx b/components/calendar/demo/card.tsx index 4c52543f12..bf9b50af16 100644 --- a/components/calendar/demo/card.tsx +++ b/components/calendar/demo/card.tsx @@ -1,15 +1,23 @@ import React from 'react'; -import { Calendar } from 'antd'; import type { Dayjs } from 'dayjs'; +import { Calendar, theme } from 'antd'; import type { CalendarMode } from 'antd/es/calendar/generateCalendar'; const App: React.FC = () => { + const { token } = theme.useToken(); + const onPanelChange = (value: Dayjs, mode: CalendarMode) => { console.log(value.format('YYYY-MM-DD'), mode); }; + const wrapperStyle = { + width: 300, + border: `1px solid ${token.colorBorderSecondary}`, + borderRadius: token.borderRadiusLG, + }; + return ( -
+
); diff --git a/components/calendar/demo/customize-header.md b/components/calendar/demo/customize-header.md index 810387be60..2fb0f5cf3a 100644 --- a/components/calendar/demo/customize-header.md +++ b/components/calendar/demo/customize-header.md @@ -5,17 +5,3 @@ ## en-US Customize Calendar header content. - -```css -.site-calendar-customize-header-wrapper { - width: 300px; - border: 1px solid #f0f0f0; - border-radius: 2px; -} -``` - - diff --git a/components/calendar/demo/customize-header.tsx b/components/calendar/demo/customize-header.tsx index 67ef789b17..20ac635eec 100644 --- a/components/calendar/demo/customize-header.tsx +++ b/components/calendar/demo/customize-header.tsx @@ -1,20 +1,28 @@ import React from 'react'; -import { Calendar, Col, Radio, Row, Select, Typography } from 'antd'; -import type { Dayjs } from 'dayjs'; import dayjs from 'dayjs'; import 'dayjs/locale/zh-cn'; +import type { Dayjs } from 'dayjs'; import dayLocaleData from 'dayjs/plugin/localeData'; +import { Calendar, Col, Radio, Row, Select, Typography, theme } from 'antd'; import type { CalendarMode } from 'antd/es/calendar/generateCalendar'; dayjs.extend(dayLocaleData); const App: React.FC = () => { + const { token } = theme.useToken(); + const onPanelChange = (value: Dayjs, mode: CalendarMode) => { console.log(value.format('YYYY-MM-DD'), mode); }; + const wrapperStyle = { + width: 300, + border: `1px solid ${token.colorBorderSecondary}`, + borderRadius: token.borderRadiusLG, + }; + return ( -
+
{ From c8b4915767704062f728ab010fc69173eb1e4b97 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Sun, 15 Jan 2023 20:45:58 +0800 Subject: [PATCH 07/10] fix: checkbox should have line-height (#40208) --- components/checkbox/style/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/components/checkbox/style/index.ts b/components/checkbox/style/index.ts index f0d1360350..281189bd62 100644 --- a/components/checkbox/style/index.ts +++ b/components/checkbox/style/index.ts @@ -44,7 +44,6 @@ export const genCheckboxStyle: GenerateStyle = (token) => { display: 'inline-flex', alignItems: 'baseline', - lineHeight: 'unset', cursor: 'pointer', // Fix checkbox & radio in flex align #30260 From bedb41b0e8a3a59b8fe21707f67902b9f5a6d144 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Sun, 15 Jan 2023 22:43:56 +0800 Subject: [PATCH 08/10] docs: changelog 5.1.5 (#40242) * docs: changelog * chore: changelog --- CHANGELOG.en-US.md | 17 +++++++++++++++++ CHANGELOG.zh-CN.md | 17 +++++++++++++++++ package.json | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index f6ddfc42c1..39f15075ae 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,23 @@ timeline: true --- +## 5.1.5 + +`2023-1-15` + +- 🐞 Fix Checkbox that label not aligned with checkbox. [#40208](https://github.com/ant-design/ant-design/pull/40208) +- 🐞 Fix Button wave effect sometime makes layout shaking. [#40192](https://github.com/ant-design/ant-design/pull/40192) +- 🐞 Fix Select crash problem. [#40158](https://github.com/ant-design/ant-design/pull/40158) [@helloqian12138](https://github.com/helloqian12138) +- 🐞 Fix Timeline custom color displaying wrong classname & alignment overflow. [#39394](https://github.com/ant-design/ant-design/pull/39394) [@Wxh16144](https://github.com/Wxh16144) +- 🐞 Fix Breadcrumb last item color. [#40119](https://github.com/ant-design/ant-design/pull/40119) [@messaooudi](https://github.com/messaooudi) +- 💄 Fix Table sticky table header shadow style. [#40171](https://github.com/ant-design/ant-design/pull/40171) [@Wxh16144](https://github.com/Wxh16144) +- 💄 Fix Segmented item hover radius style. [#40175](https://github.com/ant-design/ant-design/pull/40175) [#40179](https://github.com/ant-design/ant-design/pull/40179) +- TypeScript + - 🤖 Fix Tabs `onEdit` Callback parameter type problem. [#39926](https://github.com/ant-design/ant-design/pull/39926) [@RSS1102](https://github.com/RSS1102) +- RTL + - 💄 Fix DatePicker's next & prev icons in RTL mode. [#40238](https://github.com/ant-design/ant-design/pull/40238) [@ds1371dani](https://github.com/ds1371dani) + - 💄 Fix Badge RTL style when wrap a block element. [#40125](https://github.com/ant-design/ant-design/pull/40125) + ## 5.1.4 `2023-1-9` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 4238618599..c7f875a0b0 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,23 @@ timeline: true --- +## 5.1.5 + +`2023-1-15` + +- 🐞 修复 Checkbox 组件 label 不对齐的问题。 [#40208](https://github.com/ant-design/ant-design/pull/40208) +- 🐞 修复 Button 水波纹效果有时会使得布局抖动的问题。[#40192](https://github.com/ant-design/ant-design/pull/40192) +- 🐞 修复 Select 组件会卡住的问题。[#40158](https://github.com/ant-design/ant-design/pull/40158) [@helloqian12138](https://github.com/helloqian12138) +- 🐞 修复 Timeline 组件自定义颜色显示错误类名和对齐溢出的问题。[#39394](https://github.com/ant-design/ant-design/pull/39394) [@Wxh16144](https://github.com/Wxh16144) +- 🐞 修复 Breadcrumb 最后一项颜色。[#40119](https://github.com/ant-design/ant-design/pull/40119) [@messaooudi](https://github.com/messaooudi) +- 💄 修复 Table 固定表头阴影样式错误。[#40171](https://github.com/ant-design/ant-design/pull/40171) [@Wxh16144](https://github.com/Wxh16144) +- 💄 修复 Segmented hover 时圆角和选中圆角不一致的问题。[#40175](https://github.com/ant-design/ant-design/pull/40175) [#40179](https://github.com/ant-design/ant-design/pull/40179) +- TypeScript + - 🤖 修复 Tabs 组件 `onEdit` 类型问题。[#39926](https://github.com/ant-design/ant-design/pull/39926) [@RSS1102](https://github.com/RSS1102) +- RTL + - 💄 优化 DatePicker 在 RTL 模式下 next 和 prev 图标。[#40238](https://github.com/ant-design/ant-design/pull/40238) [@ds1371dani](https://github.com/ds1371dani) + - 💄 修复 Badge 作用在块级元素上时 RTL 样式不生效的问题。[#40125](https://github.com/ant-design/ant-design/pull/40125) + ## 5.1.4 `2023-1-9` diff --git a/package.json b/package.json index e2121ed3cd..82659fd660 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "5.1.4", + "version": "5.1.5", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", "keywords": [ From f1e92b12f5d21eece4d6bcde69093044e3a56f49 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Mon, 16 Jan 2023 00:21:56 +0800 Subject: [PATCH 09/10] chore: bump @ant-design/tolls --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 82659fd660..4d7c891ba6 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "throttle-debounce": "^5.0.0" }, "devDependencies": { - "@ant-design/tools": "^17.0.0-alpha.7", + "@ant-design/tools": "^17.0.0", "@babel/eslint-plugin": "^7.19.1", "@emotion/babel-preset-css-prop": "^11.10.0", "@emotion/css": "^11.10.5", From 28d1157d6b2dac680c262f253c6294789bd253e9 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Mon, 16 Jan 2023 09:55:52 +0800 Subject: [PATCH 10/10] type: optimization undefined type (#40241) * type: optimization undefined type * fix type * fix type * add * revert * revert * revert --- .dumi/theme/layouts/ResourceLayout/AffixTabs.tsx | 2 +- components/_util/motion.ts | 2 +- components/_util/styleChecker.ts | 2 +- components/affix/utils.ts | 2 +- components/anchor/demo/targetOffset.tsx | 2 +- components/cascader/index.tsx | 2 +- components/collapse/__tests__/index.test.tsx | 6 +++--- components/config-provider/DisabledContext.tsx | 2 +- components/config-provider/cssVariables.ts | 5 +---- components/descriptions/index.tsx | 2 +- components/form/util.ts | 4 +++- components/input/Input.tsx | 2 +- components/message/index.tsx | 6 +++--- components/notification/index.tsx | 8 ++++---- components/skeleton/Skeleton.tsx | 2 +- components/table/hooks/useFilter/FilterDropdown.tsx | 2 +- components/tree-select/demo/basic.tsx | 2 +- components/typography/Base/index.tsx | 4 +++- components/upload/UploadList/ListItem.tsx | 2 +- tests/utils.tsx | 2 +- 20 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx b/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx index e78d427079..95dc207e66 100644 --- a/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx +++ b/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx @@ -115,7 +115,7 @@ export default () => { return (
{ scrollToId(key); }} diff --git a/components/_util/motion.ts b/components/_util/motion.ts index 67d2b52fc7..baeba1cd1f 100644 --- a/components/_util/motion.ts +++ b/components/_util/motion.ts @@ -29,7 +29,7 @@ const SelectPlacements = ['bottomLeft', 'bottomRight', 'topLeft', 'topRight'] as export type SelectCommonPlacement = typeof SelectPlacements[number]; -const getTransitionDirection = (placement: SelectCommonPlacement | undefined) => { +const getTransitionDirection = (placement?: SelectCommonPlacement) => { if (placement !== undefined && (placement === 'topLeft' || placement === 'topRight')) { return `slide-down`; } diff --git a/components/_util/styleChecker.ts b/components/_util/styleChecker.ts index 0c291d4f30..80f01afc79 100644 --- a/components/_util/styleChecker.ts +++ b/components/_util/styleChecker.ts @@ -5,7 +5,7 @@ export const canUseDocElement = () => canUseDom() && window.document.documentEle export { isStyleSupport }; -let flexGapSupported: boolean | undefined; +let flexGapSupported: boolean; export const detectFlexGapSupported = () => { if (!canUseDocElement()) { return false; diff --git a/components/affix/utils.ts b/components/affix/utils.ts index e42d1f857b..43353d6875 100644 --- a/components/affix/utils.ts +++ b/components/affix/utils.ts @@ -56,7 +56,7 @@ export function addObserveTarget(target: HTMLElement | Window | null, affix?: return; } - let entity: ObserverEntity | undefined = observerEntities.find((item) => item.target === target); + let entity = observerEntities.find((item) => item.target === target); if (entity) { entity.affixList.push(affix); diff --git a/components/anchor/demo/targetOffset.tsx b/components/anchor/demo/targetOffset.tsx index f36389e025..79428a8e59 100644 --- a/components/anchor/demo/targetOffset.tsx +++ b/components/anchor/demo/targetOffset.tsx @@ -3,7 +3,7 @@ import { Anchor, Row, Col } from 'antd'; const App: React.FC = () => { const topRef = React.useRef(null); - const [targetOffset, setTargetOffset] = useState(undefined); + const [targetOffset, setTargetOffset] = useState(); useEffect(() => { setTargetOffset(topRef.current?.clientHeight); diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index e2b0062142..7d75fe200e 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -45,7 +45,7 @@ export type FilledFieldNamesType = Required; const { SHOW_CHILD, SHOW_PARENT } = RcCascader; -function highlightKeyword(str: string, lowerKeyword: string, prefixCls: string | undefined) { +function highlightKeyword(str: string, lowerKeyword: string, prefixCls?: string) { const cells = str .toLowerCase() .split(lowerKeyword) diff --git a/components/collapse/__tests__/index.test.tsx b/components/collapse/__tests__/index.test.tsx index 0b3d024924..c1b2602acb 100644 --- a/components/collapse/__tests__/index.test.tsx +++ b/components/collapse/__tests__/index.test.tsx @@ -122,9 +122,9 @@ describe('Collapse', () => { .spyOn(window, 'requestAnimationFrame') .mockImplementation((cb) => setTimeout(cb, 16.66)); - let setActiveKeyOuter: React.Dispatch>; - const Test = () => { - const [activeKey, setActiveKey] = React.useState(); + let setActiveKeyOuter: React.Dispatch>; + const Test: React.FC = () => { + const [activeKey, setActiveKey] = React.useState(); setActiveKeyOuter = setActiveKey; return (