Skip to content

Commit 849ab56

Browse files
authored
feat(Modal): split modal types for ease of export (#956)
* feat: split modal types for ease of export * replaced type with interface * change interface naming
1 parent 1c8688d commit 849ab56

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Modal.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ export interface RenderModalBackdropProps {
4646
ref: React.RefCallback<Element>;
4747
onClick: (event: React.SyntheticEvent) => void;
4848
}
49-
export interface ModalProps extends TransitionCallbacks {
49+
50+
/*
51+
Modal props are split into a version with and without index signature so that you can fully use them in another projects
52+
This is due to Typescript not playing well with index singatures e.g. when using Omit
53+
*/
54+
export interface BaseModalProps extends TransitionCallbacks {
5055
children?: React.ReactElement;
5156
role?: string;
5257
style?: React.CSSProperties;
@@ -74,7 +79,9 @@ export interface ModalProps extends TransitionCallbacks {
7479
restoreFocusOptions?: {
7580
preventScroll: boolean;
7681
};
82+
}
7783

84+
export interface ModalProps extends BaseModalProps {
7885
[other: string]: any;
7986
}
8087

0 commit comments

Comments
 (0)