From 15a195c21ae3020b1573633b0490ff818d42fb8a Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Mon, 29 Apr 2024 21:35:57 +0800 Subject: [PATCH] chore: add @types/react-is (#524) * chore: add devDependencies * chore: fix * chore: clear --- package.json | 1 + src/ref.ts | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2f9784bc..ca8fc82f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/ref.ts b/src/ref.ts index 7beb41c1..e464654f 100644 --- a/src/ref.ts +++ b/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'; @@ -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 */