@@ -212,10 +212,10 @@ type NiceModalArgs<T> = T extends keyof JSX.IntrinsicElements | React.JSXElement
212
212
? Partial < Omit < React . ComponentProps < T > , 'id' > >
213
213
: Record < string , unknown > ;
214
214
215
- export function show < T extends React . FC < any > > ( modal : T , args ?: NiceModalArgs < T > ) : Promise < unknown > ;
216
- export function show < T extends string > ( modal : T , args ?: Record < string , unknown > ) : Promise < unknown > ;
215
+ export function show < T extends any > ( modal : React . FC < any > , args ?: NiceModalArgs < React . FC < any > > ) : Promise < T > ;
216
+ export function show < T extends any > ( modal : string , args ?: Record < string , unknown > ) : Promise < T > ;
217
217
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
218
- export function show ( modal : any , args ?: any ) : Promise < unknown > {
218
+ export function show ( modal : React . FC < any > | string , args ?: NiceModalArgs < React . FC < any > > | Record < string , unknown > ) {
219
219
const modalId = getModalId ( modal ) ;
220
220
if ( typeof modal !== 'string' && ! MODAL_REGISTRY [ modalId ] ) {
221
221
register ( modalId , modal as React . FC ) ;
@@ -240,7 +240,9 @@ export function show(modal: any, args?: any): Promise<unknown> {
240
240
return modalCallbacks [ modalId ] . promise ;
241
241
}
242
242
243
- export const hide = ( modal : string | React . FC < any > ) : Promise < unknown > => {
243
+ export function hide < T > ( modal : string | React . FC < any > ) : Promise < T > ;
244
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
245
+ export function hide ( modal : string | React . FC < any > ) {
244
246
const modalId = getModalId ( modal ) ;
245
247
dispatch ( hideModal ( modalId ) ) ;
246
248
// Should also delete the callback for modal.resolve #35
@@ -261,7 +263,7 @@ export const hide = (modal: string | React.FC<any>): Promise<unknown> => {
261
263
} ;
262
264
}
263
265
return hideModalCallbacks [ modalId ] . promise ;
264
- } ;
266
+ }
265
267
266
268
export const remove = ( modalId : string ) : void => {
267
269
dispatch ( removeModal ( modalId ) ) ;
0 commit comments