v5 API 废弃流程
Amumu edited this page Aug 17, 2022
·
6 revisions
基于 feature
开启新的 branch。
interface SampleProps {
// ...
/** @deprecated `propOld` is deprecated which will be removed in next major version. Please use `propNew` instead. */
propOld?: string;
propNew?: string;
}
const Sample = (props) => {
const { propOld, propNew, ...restProps } = props;
warning(!propOld, 'Sample', '`propOld` is deprecated which will be removed in next major version. Please use `propNew` instead.');
return <Component prop={propNew ?? propOld} {...restProps} />;
}
补充对应 test case:
it('deprecated warning', () => {
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
render(<Sample propOld="xxx" />);
expect(errSpy).toHaveBeenCalledWith('xxxxxxxx');
errSpy.mockRestore();
});
🚨🚨🚨 注意:不要删除或者修改原本的测试用例,总是新增测试用例以防止改动 Break 原本用法 🚨🚨🚨
在 Demo 的 markdown 文件中搜索对应 prop,将其替换为最新 prop。
在组件文档中,搜索对应 prop 将其替换为最新 prop,🔥🔥🔥 并添加下一个 minor 版本版本号 🔥🔥🔥。
向 feature
branch 发起 PR。
上述 PR 合并后,在 next
branch 中,开新的 PR 移除该接口并且在 v5-note.md
中记录变更:
Sample 组件
dropdownClassName
替换为popupClassName
在 https://github.com/ant-design/compatible 中,参考 AutoComplete 添加对应 TS 定义 以及 warning 信息。
在 src/index.tsx
中导出组件:
export { default as Select } from './SelectBase';
export { default as AutoComplete } from './AutoComplete';
参考 AutoComplete 添加对应测试用例。
- Home
- Cookbook
- FAQ
- Template for Bug Report in IE8 9
- Contributing
- Maintaining
- Design