@@ -9,25 +9,31 @@ export interface ModalProviderProps {
99 loading ?: ( modals : ModalManager ) => ReactElement | null ;
1010 modal ?: ( modal : ModalInstance , modals : ModalManager ) => ReactElement ;
1111}
12- export interface ModalProps < ReturnValue = any > extends Record < string , any > {
12+ export interface ModalProps < ReturnValue = any > {
1313 index : number ;
1414 id : string ;
1515 isOpen : boolean ;
1616 close : ( value ?: ReturnValue ) => void ;
1717}
18- export interface ModalInstance < ReturnValue = any > {
19- component : ComponentType < any > ;
18+ export type ModalComponent < T = any , ReturnValue = any > = ComponentType < ModalProps < ReturnValue > & T > ;
19+ export interface ModalInstance < T = any , ReturnValue = any > {
20+ component : ModalComponent < T , ReturnValue > ;
2021 id : string ;
21- data ?: any ;
22+ props ?: Omit < T , keyof ModalProps < ReturnValue > > ;
2223 isOpen : boolean ;
2324 close : ( value ?: ReturnValue ) => void ;
2425 index : number ;
2526 onBeforeClose : ( callback : ( ) => boolean ) => void ;
2627}
2728export interface ModalManager {
28- open : < T = any , R = any > ( component : ComponentType < T > | ( ( ) => Promise < {
29- default : ComponentType < T > ;
30- } > ) , data ?: any , options ?: ModalOptions ) => Promise < R > ;
29+ open : {
30+ < T extends Record < string , never > , R = any > ( component : ModalComponent < T , R > | ( ( ) => Promise < {
31+ default : ModalComponent < T , R > ;
32+ } > ) , options ?: ModalOptions ) : Promise < R > ;
33+ < T , R = any > ( component : ModalComponent < T , R > | ( ( ) => Promise < {
34+ default : ModalComponent < T , R > ;
35+ } > ) , props : Omit < T , keyof ModalProps < R > > , options ?: ModalOptions ) : Promise < R > ;
36+ } ;
3137 close : ( n ?: number ) => boolean ;
3238 closeById : ( id : string ) => boolean ;
3339 closeAll : ( ) => boolean ;
0 commit comments