Browse Source

type: supplementary React.FC type (#43410)

* type: supplementary React.FC  type

* fix: remove useless code

* revert: remove useStyle

* revert: card-top

* Update card-top.tsx
pull/42485/merge
thinkasany 1 year ago
committed by GitHub
parent
commit
f566e3b24b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      components/button/demo/chinese-chars-loading.tsx
  2. 2
      components/color-picker/__tests__/index.test.tsx
  3. 4
      components/form/__tests__/index.test.tsx
  4. 2
      components/form/demo/validate-only.tsx
  5. 4
      components/image/demo/preview-group-top-progress.tsx
  6. 2
      components/input/__tests__/index.test.tsx
  7. 2
      components/input/__tests__/textarea.test.tsx
  8. 2
      components/table/__tests__/Table.filter.test.tsx
  9. 14
      components/tag/demo/draggable.tsx
  10. 4
      components/transfer/__tests__/index.test.tsx

4
components/button/demo/chinese-chars-loading.tsx

@ -1,13 +1,13 @@
// @ts-nocheck // @ts-nocheck
import React from 'react';
import { PoweroffOutlined } from '@ant-design/icons'; import { PoweroffOutlined } from '@ant-design/icons';
import { Button, Space } from 'antd'; import { Button, Space } from 'antd';
import React from 'react';
const Text1 = () => '部署'; const Text1 = () => '部署';
const Text2 = () => <span></span>; const Text2 = () => <span></span>;
const Text3 = () => 'Submit'; const Text3 = () => 'Submit';
const App = () => ( const App: React.FC = () => (
<Space wrap> <Space wrap>
<Button loading></Button> <Button loading></Button>
<Button loading> <Button loading>

2
components/color-picker/__tests__/index.test.tsx

@ -55,7 +55,7 @@ describe('ColorPicker', () => {
}); });
it('Should component custom trigger work', async () => { it('Should component custom trigger work', async () => {
const App = () => { const App: React.FC = () => {
const [color, setColor] = useState<Color | string>('hsb(215, 91%, 100%)'); const [color, setColor] = useState<Color | string>('hsb(215, 91%, 100%)');
const colorString = useMemo( const colorString = useMemo(
() => (typeof color === 'string' ? color : color.toHsbString()), () => (typeof color === 'string' ? color : color.toHsbString()),

4
components/form/__tests__/index.test.tsx

@ -1641,7 +1641,7 @@ describe('Form', () => {
<DatePicker.YearPicker key="DatePicker.YearPicker" disabled={disabled} />, <DatePicker.YearPicker key="DatePicker.YearPicker" disabled={disabled} />,
<DatePicker.TimePicker key="DatePicker.TimePicker" disabled={disabled} />, <DatePicker.TimePicker key="DatePicker.TimePicker" disabled={disabled} />,
]; ];
const App = () => <Form disabled>{renderComps(false)}</Form>; const App: React.FC = () => <Form disabled>{renderComps(false)}</Form>;
const wrapper = render(<App />); const wrapper = render(<App />);
expect(wrapper.container.querySelectorAll('[disabled]').length).toBe(0); expect(wrapper.container.querySelectorAll('[disabled]').length).toBe(0);
@ -1803,7 +1803,7 @@ describe('Form', () => {
return <Input {...props} />; return <Input {...props} />;
}; };
const App = () => ( const App: React.FC = () => (
<Form> <Form>
<Form.Item> <Form.Item>
<Form.Item name="test" label="test" rules={[{ len: 3, message: 'error.' }]}> <Form.Item name="test" label="test" rules={[{ len: 3, message: 'error.' }]}>

2
components/form/demo/validate-only.tsx

@ -26,7 +26,7 @@ const SubmitButton = ({ form }: { form: FormInstance }) => {
); );
}; };
const App = () => { const App: React.FC = () => {
const [form] = Form.useForm(); const [form] = Form.useForm();
return ( return (

4
components/image/demo/preview-group-top-progress.tsx

@ -1,7 +1,7 @@
import React from 'react';
import { Image } from 'antd'; import { Image } from 'antd';
import React from 'react';
const App = () => ( const App: React.FC = () => (
<Image.PreviewGroup <Image.PreviewGroup
preview={{ countRender: (current, total) => `当前 ${current} / 总计 ${total}` }} preview={{ countRender: (current, total) => `当前 ${current} / 总计 ${total}` }}
> >

2
components/input/__tests__/index.test.tsx

@ -398,7 +398,7 @@ describe('Input allowClear', () => {
// https://github.com/ant-design/ant-design/issues/31927 // https://github.com/ant-design/ant-design/issues/31927
it('should correctly when useState', () => { it('should correctly when useState', () => {
const App = () => { const App: React.FC = () => {
const [query, setQuery] = useState(''); const [query, setQuery] = useState('');
return ( return (
<Input <Input

2
components/input/__tests__/textarea.test.tsx

@ -489,7 +489,7 @@ describe('TextArea allowClear', () => {
// https://github.com/ant-design/ant-design/issues/31927 // https://github.com/ant-design/ant-design/issues/31927
it('should correctly when useState', () => { it('should correctly when useState', () => {
const App = () => { const App: React.FC = () => {
const [query, setQuery] = useState(''); const [query, setQuery] = useState('');
return ( return (
<TextArea <TextArea

2
components/table/__tests__/Table.filter.test.tsx

@ -1472,7 +1472,7 @@ describe('Table.filter', () => {
}); });
it('filtered should work after change', () => { it('filtered should work after change', () => {
const App = () => { const App: React.FC = () => {
const [filtered, setFiltered] = React.useState(true); const [filtered, setFiltered] = React.useState(true);
const columns = [ const columns = [
{ {

14
components/tag/demo/draggable.tsx

@ -1,14 +1,14 @@
import React, { useState } from 'react'; import { DndContext, PointerSensor, closestCenter, useSensor, useSensors } from '@dnd-kit/core';
import { Tag } from 'antd'; import type { DragEndEvent } from '@dnd-kit/core/dist/types/index';
import { DndContext, PointerSensor, useSensor, useSensors, closestCenter } from '@dnd-kit/core';
import { import {
arrayMove,
useSortable,
SortableContext, SortableContext,
arrayMove,
horizontalListSortingStrategy, horizontalListSortingStrategy,
useSortable,
} from '@dnd-kit/sortable'; } from '@dnd-kit/sortable';
import { Tag } from 'antd';
import type { FC } from 'react'; import type { FC } from 'react';
import type { DragEndEvent } from '@dnd-kit/core/dist/types/index'; import React, { useState } from 'react';
type Item = { type Item = {
id: number; id: number;
@ -43,7 +43,7 @@ const DraggableTag: FC<DraggableTagProps> = (props) => {
); );
}; };
const App = () => { const App: React.FC = () => {
const [items, setItems] = useState<Item[]>([ const [items, setItems] = useState<Item[]>([
{ {
id: 1, id: 1,

4
components/transfer/__tests__/index.test.tsx

@ -646,7 +646,7 @@ describe('Transfer', () => {
it('control mode select all should not throw warning', () => { it('control mode select all should not throw warning', () => {
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const App = () => { const App: React.FC = () => {
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
const onSelectChange = (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => { const onSelectChange = (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => {
@ -686,7 +686,7 @@ describe('immutable data', () => {
}); });
it('prevent error when reset data in some cases', () => { it('prevent error when reset data in some cases', () => {
const App = () => { const App: React.FC = () => {
const [mockData, setMockData] = useState<DefaultRecordType[]>([]); const [mockData, setMockData] = useState<DefaultRecordType[]>([]);
const [targetKeys, setTargetKeys] = useState<string[]>([]); const [targetKeys, setTargetKeys] = useState<string[]>([]);

Loading…
Cancel
Save