Skip to content

Commit fe80b2f

Browse files
committed
fix useModal default value type
1 parent 45b33c0 commit fe80b2f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,17 +280,13 @@ export function useModal(modal: string, args?: Record<string, unknown>): NiceMod
280280
export function useModal<
281281
T extends React.FC<any>,
282282
ComponentProps extends NiceModalArgs<T>,
283-
PreparedProps extends Partial<ComponentProps>,
283+
PreparedProps extends Partial<ComponentProps> = {} | ComponentProps,
284284
RemainingProps = Omit<ComponentProps, keyof PreparedProps> & Partial<ComponentProps>,
285285
>(
286286
modal: T,
287287
args?: PreparedProps,
288288
): Omit<NiceModalHandler, 'show'> & {
289-
show: {
290-
[K in keyof RemainingProps]: RemainingProps[K] extends Exclude<RemainingProps[keyof RemainingProps], undefined>
291-
? K
292-
: never;
293-
}[keyof RemainingProps] extends undefined
289+
show: Partial<RemainingProps> extends RemainingProps
294290
? (args?: RemainingProps) => Promise<unknown>
295291
: (args: RemainingProps) => Promise<unknown>;
296292
};

0 commit comments

Comments
 (0)