Skip to content

Commit 6fc6562

Browse files
authored
Merge pull request #69 from SevenOutman/perf/show-props-generic
perf: improve type inference for NiceModal.show
2 parents 8849354 + cdd03d8 commit 6fc6562

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)