Skip to content

Commit 45a3b7a

Browse files
committed
Fix types
1 parent cf1805d commit 45a3b7a

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/useLockBodyScroll.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ const doc: Document | undefined = typeof document === 'object' ? document : unde
4646
let documentListenerAdded = false;
4747

4848
export default !doc
49-
? function useLockBodyMock(_locked: boolean = true, _elementRef?: RefObject<HTMLElement | null>) {}
49+
? function useLockBodyMock(
50+
_locked: boolean = true,
51+
_elementRef?: RefObject<HTMLElement | null>
52+
) {}
5053
: function useLockBody(locked: boolean = true, elementRef?: RefObject<HTMLElement | null>) {
5154
const bodyRef = useRef(doc!.body);
5255
elementRef = elementRef || bodyRef;

src/useMouseHovered.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export interface UseMouseHoveredOptions {
99

1010
const nullRef = { current: null };
1111

12-
const useMouseHovered = (ref: RefObject<Element | null>, options: UseMouseHoveredOptions = {}): State => {
12+
const useMouseHovered = (
13+
ref: RefObject<Element | null>,
14+
options: UseMouseHoveredOptions = {}
15+
): State => {
1316
const whenHovered = !!options.whenHovered;
1417
const bound = !!options.bound;
1518

tests/useEnsuredForwardedRef.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test('should return a valid ref when the forwarded ref is undefined', () => {
4949

5050
const { ensuredRef } = result.current;
5151

52-
expect(ensuredRef.current.id).toBe('test_id');
52+
expect(ensuredRef.current?.id).toBe('test_id');
5353
});
5454

5555
test('should return a valid ref when using the wrapper function style', () => {

0 commit comments

Comments
 (0)