Skip to content

Commit cdd03d8

Browse files
committed
perf: improve type inference for NiceModal.show
1 parent 22a6a4e commit cdd03d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ type NiceModalArgs<T> = T extends keyof JSX.IntrinsicElements | React.JSXElement
212212
? Partial<Omit<React.ComponentProps<T>, 'id'>>
213213
: Record<string, unknown>;
214214

215-
export function show<T extends any>(modal: React.FC<any>, args?: NiceModalArgs<React.FC<any>>): Promise<T>;
215+
export function show<T extends any, C extends React.FC>(modal: C, args?: Omit<React.ComponentProps<C>, 'id'>): Promise<T>;
216216
export function show<T extends any>(modal: string, args?: Record<string, unknown>): Promise<T>;
217217
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
218218
export function show(modal: React.FC<any> | string, args?: NiceModalArgs<React.FC<any>> | Record<string, unknown>) {

0 commit comments

Comments
 (0)