Skip to content

Commit

Permalink
chore: add @types/react-is (#524)
Browse files Browse the repository at this point in the history
* chore: add devDependencies

* chore: fix

* chore: clear
  • Loading branch information
li-jia-nan committed Apr 29, 2024
1 parent 63fc17e commit 15a195c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -47,6 +47,7 @@
"@types/jest": "^29.4.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-is": "^18.3.0",
"@types/responselike": "^1.0.0",
"@types/warning": "^3.0.0",
"@umijs/fabric": "^3.0.0",
Expand Down
7 changes: 2 additions & 5 deletions src/ref.ts
@@ -1,6 +1,6 @@
/* eslint-disable no-param-reassign */
import type * as React from 'react';
import { isValidElement, ReactNode } from 'react';
import { isValidElement } from 'react';
import { ForwardRef, isFragment, isMemo } from 'react-is';
import useMemo from './hooks/useMemo';

Expand Down Expand Up @@ -59,19 +59,16 @@ export function supportRef(nodeOrComponent: any): boolean {
) {
return false;
}

return true;
}

export function supportNodeRef(node: ReactNode): boolean {
export function supportNodeRef(node: React.ReactNode): boolean {
if (!isValidElement(node)) {
return false;
}

if (isFragment(node)) {
return false;
}

return supportRef(node);
}
/* eslint-enable */

0 comments on commit 15a195c

Please sign in to comment.