Skip to content

Commit d0f1a4e

Browse files
author
farfromrefug
committed
chore: typescript generics
1 parent e642093 commit d0f1a4e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/dom/navigation.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PageElement from "./native/PageElement";
55
import NativeViewElementNode from "./native/NativeViewElementNode";
66
import { _rootModalViews } from "@nativescript/core/ui/core/view";
77

8-
export type ViewSpec = View | NativeViewElementNode<View>
8+
export type ViewSpec<T extends ViewBase = View> = T | NativeViewElementNode<T>
99
export type FrameSpec = Frame | FrameElement | string
1010
export type PageSpec<T> = typeof SvelteComponent<T>;
1111
export interface NavigationOptions<T> {
@@ -33,7 +33,7 @@ export function resolveFrame(frameSpec: FrameSpec): Frame {
3333
return targetFrame;
3434
}
3535

36-
export function resolveTarget(viewSpec: ViewSpec): View {
36+
export function resolveTarget<T extends ViewBase = View>(viewSpec: ViewSpec<T>): T {
3737
if (viewSpec instanceof View) {
3838
return viewSpec;
3939
}
@@ -47,7 +47,7 @@ export interface ComponentInstanceInfo<T extends ViewBase = View, U = SvelteComp
4747
}
4848

4949
export function resolveComponentElement<T, U extends ViewBase = View>(viewSpec: typeof SvelteComponent<T>, props?: T): ComponentInstanceInfo<U, SvelteComponent<T>> {
50-
const dummy = createElement('fragment', window.document as any);
50+
const dummy = createElement('fragment', window.document as unknown as DocumentNode);
5151
const viewInstance = new viewSpec({ target: dummy, props });
5252
const element = dummy.firstElement() as NativeViewElementNode<U>;
5353
return { element, viewInstance };

0 commit comments

Comments
 (0)