From 39b01c75e7fc86b4108c47dc3fc1d1df66b3f0cf Mon Sep 17 00:00:00 2001 From: Cameron Martin Date: Wed, 3 Apr 2019 11:18:30 +0100 Subject: [PATCH] Fixed types of onRequestClose argument. This is defined as being native events, but are actually Synthetic events. See https://github.com/reactjs/react-modal/blob/988f55a277373d119a4c37e7d4cce7e681147326/src/components/ModalPortal.js --- types/react-modal/index.d.ts | 2 +- types/react-modal/react-modal-tests.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-modal/index.d.ts b/types/react-modal/index.d.ts index 157e646837..3024717498 100644 --- a/types/react-modal/index.d.ts +++ b/types/react-modal/index.d.ts @@ -68,7 +68,7 @@ declare namespace ReactModal { onAfterClose?(): void; /* Function that will be run when the modal is requested to be closed, prior to actually closing. */ - onRequestClose?(event: (MouseEvent | KeyboardEvent)): void; + onRequestClose?(event: (React.MouseEvent | React.KeyboardEvent)): void; /* Number indicating the milliseconds to wait before closing the modal. Defaults to zero (no timeout). */ closeTimeoutMS?: number; diff --git a/types/react-modal/react-modal-tests.tsx b/types/react-modal/react-modal-tests.tsx index 7da14cd65c..1b9593df32 100644 --- a/types/react-modal/react-modal-tests.tsx +++ b/types/react-modal/react-modal-tests.tsx @@ -13,7 +13,7 @@ class ExampleOfUsingReactModal extends React.Component { render() { const onAfterOpenFn = () => { }; const onAfterCloseFn = () => { }; - const onRequestCloseFn = () => { }; + const onRequestCloseFn = (event: React.MouseEvent | React.KeyboardEvent) => { }; const customStyle = { overlay: { position: 'fixed',