Skip to content

Commit

Permalink
fix(types): fix Modal prop types (#802)
Browse files Browse the repository at this point in the history
The React types fail on the index signature and props were getting set to any
  • Loading branch information
jquense authored Apr 22, 2020
1 parent 2a4c053 commit caa0531
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ export interface ModalHandle {
backdrop: HTMLElement | null;
}

const Modal = forwardRef<ModalHandle, ModalProps>(
const Modal: React.ForwardRefExoticComponent<
ModalProps & React.RefAttributes<ModalHandle>
> = forwardRef(
(
{
show = false,
Expand Down Expand Up @@ -150,7 +152,7 @@ const Modal = forwardRef<ModalHandle, ModalProps>(

...rest
}: ModalProps,
ref,
ref: React.Ref<ModalHandle>,
) => {
const container = useWaitForDOMRef(containerRef);
const modal = useModalManager(providedManager);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit caa0531

Please sign in to comment.