Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
pbr1111 committed Sep 14, 2023
1 parent bddffc9 commit f0ae229
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/use-resize-observer-ref.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
useRef,
useCallback,
Ref,
RefCallback,
useLayoutEffect,
useEffect
Expand All @@ -16,7 +15,7 @@ type ChangeCallback = (newSize: Size, oldSize: Size) => void;

const useResizeObserverRef = <T extends Element>(
onChange: ChangeCallback
): Ref<T> => {
): RefCallback<T> => {
const animationFrameId = useRef<number>();
const nodeRef = useRef<T | null>();
const resizeObserverRef = useRef<ResizeObserver>();
Expand Down
4 changes: 2 additions & 2 deletions src/use-resize-observer.ts
Original file line number Diff line number Diff line change
@@ -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<T> = {
ref: Ref<T>;
ref: RefCallback<T>;
} & Size;

const useResizeObserver = <T extends Element>(): ResizeObserverObject<T> => {
Expand Down
11 changes: 9 additions & 2 deletions src/use-throttle-resize-observer.ts
Original file line number Diff line number Diff line change
@@ -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<T> = {
ref: Ref<T>;
ref: RefCallback<T>;
} & Size;

const useThrottleResizeObserver = <T extends Element>(
Expand Down

0 comments on commit f0ae229

Please sign in to comment.