Skip to content

Commit 244f4b3

Browse files
committed
fix: fix
1 parent de947ad commit 244f4b3

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/Portal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useRef, useEffect, forwardRef, useImperativeHandle } from 'react';
33
import ReactDOM from 'react-dom';
44
import canUseDom from './Dom/canUseDom';
55

6-
export type PortalRef = {};
6+
export type PortalRef = object;
77

88
export interface PortalProps {
99
didUpdate?: (prevProps: PortalProps) => void;

src/PortalWrapper.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/* eslint-disable no-underscore-dangle,react/require-default-props */
22
import * as React from 'react';
33
import raf from './raf';
4-
import Portal, { PortalRef } from './Portal';
4+
import Portal from './Portal';
5+
import type { PortalRef } from './Portal';
56
import canUseDom from './Dom/canUseDom';
67
import setStyle from './setStyle';
78
import ScrollLocker from './Dom/scrollLocker';
@@ -58,7 +59,7 @@ export interface PortalWrapperProps {
5859
class PortalWrapper extends React.Component<PortalWrapperProps> {
5960
container?: HTMLElement;
6061

61-
componentRef: React.RefObject<PortalRef> = React.createRef();
62+
componentRef = React.createRef<PortalRef>();
6263

6364
rafId?: number;
6465

@@ -72,8 +73,8 @@ class PortalWrapper extends React.Component<PortalWrapperProps> {
7273
}
7374

7475
renderComponent?: (info: {
75-
afterClose: Function;
76-
onClose: Function;
76+
afterClose: (...params: any[]) => void;
77+
onClose: (...params: any[]) => void;
7778
visible: boolean;
7879
}) => void;
7980

src/hooks/useEvent.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
/* eslint-disable @typescript-eslint/ban-types */
2+
/* eslint-disable react-hooks/exhaustive-deps */
13
import * as React from 'react';
24

3-
export default function useEvent<T extends Function>(callback: T): T {
5+
function useEvent<T extends Function>(callback: T): T {
46
const fnRef = React.useRef<any>();
57
fnRef.current = callback;
68

@@ -11,3 +13,5 @@ export default function useEvent<T extends Function>(callback: T): T {
1113

1214
return memoFn;
1315
}
16+
17+
export default useEvent;

0 commit comments

Comments
 (0)