Skip to content

Commit c56a410

Browse files
committed
fix: svelte typings fix
1 parent 7a7d60a commit c56a410

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ui-popover/svelte/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import type { PopoverOptions as IPopoverOptions } from '..';
55
// eslint-disable-next-line no-duplicate-imports
66
import { 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
}
1414
interface ComponentInstanceInfo {
1515
element: NativeViewElementNode<View>;
@@ -18,14 +18,14 @@ interface ComponentInstanceInfo {
1818

1919
const 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

Comments
 (0)