Skip to content

Commit

Permalink
Exclude children from interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ooade committed Jan 27, 2021
1 parent 636f624 commit 6b92182
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-click-away-listener",
"version": "1.5.1",
"version": "2.0.0-alpha.0",
"description": "A simple click away listener built with React Hooks",
"main": "dist/react-click-away-listener.js",
"module": "dist/react-click-away-listener.es.js",
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {
useRef,
useEffect,
ReactElement,
MutableRefObject,
FunctionComponent
} from 'react';
Expand All @@ -13,7 +14,6 @@ interface Props extends React.HTMLAttributes<HTMLElement> {
onClickAway: (event: Events) => void;
mouseEvent?: MouseEvents;
touchEvent?: TouchEvents;
children: React.ReactElement;
}

const ClickAwayListener: FunctionComponent<Props> = ({
Expand Down Expand Up @@ -50,7 +50,7 @@ const ClickAwayListener: FunctionComponent<Props> = ({
};
}, [mouseEvent, onClickAway, touchEvent]);

return React.cloneElement(children, {
return React.cloneElement(children as ReactElement, {
ref: node,
onClick: handleBubbledEvents,
onTouchEnd: handleBubbledEvents
Expand Down

0 comments on commit 6b92182

Please sign in to comment.