@@ -221,7 +221,7 @@ type NiceModalArgs<T> = T extends keyof JSX.IntrinsicElements | React.JSXElement
221
221
: Record < string , unknown > ;
222
222
export function show < T extends any , C extends any > (
223
223
modal : React . FC < C > ,
224
- args ?: NiceModalArgs < React . FC < C > > ,
224
+ args ?: Partial < NiceModalArgs < React . FC < C > > > ,
225
225
) : Promise < T > ;
226
226
227
227
// export function show<T extends any, C extends React.FC>(modal: C, args?: Omit<React.ComponentProps<C>, 'id'>): Promise<T>;
@@ -293,20 +293,13 @@ const setFlags = (modalId: string, flags: Record<string, unknown>): void => {
293
293
} ;
294
294
export function useModal ( ) : NiceModalHandler ;
295
295
export function useModal ( modal : string , args ?: Record < string , unknown > ) : NiceModalHandler ;
296
- export function useModal <
297
- T extends React . FC < any > ,
298
- ComponentProps extends NiceModalArgs < T > ,
299
- PreparedProps extends Partial < ComponentProps > = { } | ComponentProps ,
300
- RemainingProps = Omit < ComponentProps , keyof PreparedProps > & Partial < ComponentProps > ,
301
- ResolveType = unknown ,
302
- > (
303
- modal : T ,
304
- args ?: PreparedProps ,
296
+ export function useModal < C extends any , P extends Partial < NiceModalArgs < React . FC < C > > > > (
297
+ modal : React . FC < C > ,
298
+ args ?: P ,
305
299
) : Omit < NiceModalHandler , 'show' > & {
306
- show : Partial < RemainingProps > extends RemainingProps
307
- ? ( args ?: RemainingProps ) => Promise < ResolveType >
308
- : ( args : RemainingProps ) => Promise < ResolveType > ;
300
+ show : ( args ?: P ) => Promise < unknown > ;
309
301
} ;
302
+
310
303
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
311
304
export function useModal ( modal ?: any , args ?: any ) : any {
312
305
const modals = useContext ( NiceModalContext ) ;
0 commit comments