Skip to content

Commit

Permalink
fix typescript issues
Browse files Browse the repository at this point in the history
  • Loading branch information
knaveenkumar3576 committed Jul 2, 2024
1 parent 5a72450 commit 03f0385
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
12 changes: 3 additions & 9 deletions packages/core/src/hooks/useDroppable.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import {useCallback, useContext, useEffect, useRef} from 'react';
import {
useIsomorphicLayoutEffect,
useLatestValue,
useNodeRef,
useUniqueId,
} from '@dnd-kit/utilities';
import {useLatestValue, useNodeRef, useUniqueId} from '@dnd-kit/utilities';

import {InternalContext, Action, Data} from '../store';
import type {ClientRect, UniqueIdentifier} from '../types';
Expand Down Expand Up @@ -43,9 +38,8 @@ export function useDroppable({
resizeObserverConfig,
}: UseDroppableArguments) {
const key = useUniqueId(ID_PREFIX);
const {active, dispatch, over, measureDroppableContainers} = useContext(
InternalContext
);
const {active, dispatch, over, measureDroppableContainers} =
useContext(InternalContext);
const previous = useRef({disabled});
const resizeObserverConnected = useRef(false);
const rect = useRef<ClientRect | null>(null);
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/hooks/utilities/useRect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useReducer} from 'react';
import {useState} from 'react';
import {useIsomorphicLayoutEffect} from '@dnd-kit/utilities';

import type {ClientRect} from '../../types';
Expand All @@ -16,10 +16,10 @@ export function useRect(
measure: (element: HTMLElement) => ClientRect = defaultMeasure,
fallbackRect?: ClientRect | null
) {
const [rect, setRect] = useState(null);
const [rect, setRect] = useState<ClientRect | null>(null);

function measureRect() {
setRect((currentRect: ClientRect | null) => {
setRect((currentRect): ClientRect | null => {
if (!element) {
return null;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/hooks/utilities/useRects.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useState} from 'react';
import {getWindow, useIsomorphicLayoutEffect} from '@dnd-kit/utilities';

import type {ClientRect} from '../../types';
Expand All @@ -17,7 +18,7 @@ export function useRects(
const windowRect = useWindowRect(
firstElement ? getWindow(firstElement) : null
);
const [rects, setRects] = useState(defaultValue);
const [rects, setRects] = useState<ClientRect[]>(defaultValue);

function measureRects() {
setRects(() => {
Expand Down

0 comments on commit 03f0385

Please sign in to comment.