From caa05316151953eb839a6fe75cb4a36064f76720 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Wed, 22 Apr 2020 15:48:00 -0400 Subject: [PATCH] fix(types): fix Modal prop types (#802) The React types fail on the index signature and props were getting set to any --- src/Modal.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Modal.tsx b/src/Modal.tsx index 02183509..8c29f065 100644 --- a/src/Modal.tsx +++ b/src/Modal.tsx @@ -115,7 +115,9 @@ export interface ModalHandle { backdrop: HTMLElement | null; } -const Modal = forwardRef( +const Modal: React.ForwardRefExoticComponent< + ModalProps & React.RefAttributes +> = forwardRef( ( { show = false, @@ -150,7 +152,7 @@ const Modal = forwardRef( ...rest }: ModalProps, - ref, + ref: React.Ref, ) => { const container = useWaitForDOMRef(containerRef); const modal = useModalManager(providedManager); @@ -517,11 +519,11 @@ const propTypes = { * A ModalManager instance used to track and manage the state of open * Modals. Useful when customizing how modals interact within a container */ - manager: PropTypes.object, + manager: PropTypes.instanceOf(ModalManager), }; Modal.displayName = 'Modal'; -Modal.propTypes = propTypes; +Modal.propTypes = propTypes as any; export default Object.assign(Modal, { Manager: ModalManager,