Skip to content

Commit 8fdaa7d

Browse files
committed
update
1 parent 36e4828 commit 8fdaa7d

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

tests/ref-19.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('ref: React 19', () => {
4545
});
4646

4747
it('useComposeRef', () => {
48-
const Demo = ({ children }: { children: React.ReactElement }) => {
48+
const Demo: React.FC<React.PropsWithChildren> = ({ children }) => {
4949
const ref = React.useRef<HTMLDivElement>(null);
5050
const childRef = getNodeRef(children); // Should get child real `ref` props
5151
const mergedRef = useComposeRef(ref, childRef);
@@ -59,7 +59,10 @@ describe('ref: React 19', () => {
5959

6060
return (
6161
<>
62-
{React.cloneElement(children, { ref: mergedRef })}
62+
{React.cloneElement<{ ref?: any }>(
63+
children as React.ReactElement<any>,
64+
{ ref: mergedRef },
65+
)}
6366
<div className="test-output">{childClassName}</div>
6467
</>
6568
);
@@ -79,7 +82,6 @@ describe('ref: React 19', () => {
7982

8083
it('supportRef with not provide ref', () => {
8184
const Empty = () => <div />;
82-
8385
const Checker = ({ children }: { children: React.ReactElement }) => {
8486
return <p>{String(supportRef(children))}</p>;
8587
};

tests/toArray-19.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ jest.mock('react-dom/test-utils', () => {
2222
return reactDom19Test;
2323
});
2424

25-
class UL extends React.Component<{
26-
children?: React.ReactNode;
27-
}> {
25+
class UL extends React.Component<React.PropsWithChildren<any>> {
2826
render() {
2927
return <ul>{this.props.children}</ul>;
3028
}
@@ -33,7 +31,6 @@ class UL extends React.Component<{
3331
describe('toArray', () => {
3432
it('Fragment', () => {
3533
const ulRef = React.createRef<UL>();
36-
3734
render(
3835
<UL ref={ulRef}>
3936
<li key="1">1</li>
@@ -49,7 +46,6 @@ describe('toArray', () => {
4946
</React.Fragment>
5047
</UL>,
5148
);
52-
5349
const children = toArray(ulRef.current.props.children);
5450
expect(children).toHaveLength(5);
5551
expect(children.map(c => c.key)).toEqual(['1', '2', '3', '4', '5']);

0 commit comments

Comments
 (0)