@@ -5,11 +5,11 @@ import type { PopoverOptions as IPopoverOptions } from '..';
55// eslint-disable-next-line no-duplicate-imports
66import { showPopover as nativeShowPopover } from '..' ;
77
8- type ViewSpec = typeof SvelteComponent ;
9- export interface PopoverOptions extends Omit < IPopoverOptions , 'anchor' > {
10- view : ViewSpec ;
8+ type ViewSpec < T > = typeof SvelteComponent < T > ;
9+ export interface PopoverOptions < T > extends Omit < IPopoverOptions , 'anchor' > {
10+ view : ViewSpec < T > ;
1111 anchor ?: NativeViewElementNode < View > | View ;
12- props ?: any ;
12+ props ?: T ;
1313}
1414interface ComponentInstanceInfo {
1515 element : NativeViewElementNode < View > ;
@@ -18,14 +18,14 @@ interface ComponentInstanceInfo {
1818
1919const modalStack : any [ ] = [ ] ;
2020
21- export function resolveComponentElement ( viewSpec : ViewSpec , props ?: any ) : ComponentInstanceInfo {
21+ export function resolveComponentElement < T = any > ( viewSpec : ViewSpec < T > , props ?: any ) : ComponentInstanceInfo {
2222 const dummy = createElement ( 'fragment' , window . document as any ) ;
2323 const viewInstance = new viewSpec ( { target : dummy , props } ) ;
2424 const element = dummy . firstElement ( ) as NativeViewElementNode < View > ;
2525 return { element, viewInstance } ;
2626}
2727
28- export function showPopover < T > ( modalOptions : PopoverOptions ) {
28+ export function showPopover < T , U > ( modalOptions : PopoverOptions < U > ) {
2929 const { view, anchor, props = { } , ...options } = modalOptions ;
3030 // Get this before any potential new frames are created by component below
3131 const anchorView : View = anchor instanceof View ? anchor : anchor . nativeView ;
0 commit comments