From f0ae229cd6faeaab9608e2830b2a416814cbc91c Mon Sep 17 00:00:00 2001 From: Pol Bonastre Date: Thu, 14 Sep 2023 13:16:48 +0200 Subject: [PATCH] fix: types --- src/use-resize-observer-ref.ts | 3 +-- src/use-resize-observer.ts | 4 ++-- src/use-throttle-resize-observer.ts | 11 +++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/use-resize-observer-ref.ts b/src/use-resize-observer-ref.ts index 8af9f84..0b71df8 100644 --- a/src/use-resize-observer-ref.ts +++ b/src/use-resize-observer-ref.ts @@ -1,7 +1,6 @@ import { useRef, useCallback, - Ref, RefCallback, useLayoutEffect, useEffect @@ -16,7 +15,7 @@ type ChangeCallback = (newSize: Size, oldSize: Size) => void; const useResizeObserverRef = ( onChange: ChangeCallback -): Ref => { +): RefCallback => { const animationFrameId = useRef(); const nodeRef = useRef(); const resizeObserverRef = useRef(); diff --git a/src/use-resize-observer.ts b/src/use-resize-observer.ts index 5768df8..c4ef067 100644 --- a/src/use-resize-observer.ts +++ b/src/use-resize-observer.ts @@ -1,8 +1,8 @@ -import { useState, useMemo, Ref, useCallback } from 'react'; +import { useState, useMemo, RefCallback, useCallback } from 'react'; import { useResizeObserverRef, Size } from './use-resize-observer-ref'; type ResizeObserverObject = { - ref: Ref; + ref: RefCallback; } & Size; const useResizeObserver = (): ResizeObserverObject => { diff --git a/src/use-throttle-resize-observer.ts b/src/use-throttle-resize-observer.ts index ea8ec39..4b02cb1 100644 --- a/src/use-throttle-resize-observer.ts +++ b/src/use-throttle-resize-observer.ts @@ -1,8 +1,15 @@ -import { Ref, useState, useMemo, useEffect, useRef, useCallback } from 'react'; +import { + RefCallback, + useState, + useMemo, + useEffect, + useRef, + useCallback +} from 'react'; import { useResizeObserverRef, Size } from './use-resize-observer-ref'; type ResizeObserverObject = { - ref: Ref; + ref: RefCallback; } & Size; const useThrottleResizeObserver = (