Skip to content

Commit 15a195c

Browse files
authored
chore: add @types/react-is (#524)
* chore: add devDependencies * chore: fix * chore: clear
1 parent 63fc17e commit 15a195c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"@types/jest": "^29.4.0",
4848
"@types/react": "^18.0.0",
4949
"@types/react-dom": "^18.0.0",
50+
"@types/react-is": "^18.3.0",
5051
"@types/responselike": "^1.0.0",
5152
"@types/warning": "^3.0.0",
5253
"@umijs/fabric": "^3.0.0",

src/ref.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-param-reassign */
22
import type * as React from 'react';
3-
import { isValidElement, ReactNode } from 'react';
3+
import { isValidElement } from 'react';
44
import { ForwardRef, isFragment, isMemo } from 'react-is';
55
import useMemo from './hooks/useMemo';
66

@@ -59,19 +59,16 @@ export function supportRef(nodeOrComponent: any): boolean {
5959
) {
6060
return false;
6161
}
62-
6362
return true;
6463
}
6564

66-
export function supportNodeRef(node: ReactNode): boolean {
65+
export function supportNodeRef(node: React.ReactNode): boolean {
6766
if (!isValidElement(node)) {
6867
return false;
6968
}
70-
7169
if (isFragment(node)) {
7270
return false;
7371
}
74-
7572
return supportRef(node);
7673
}
7774
/* eslint-enable */

0 commit comments

Comments
 (0)