Skip to content

Commit

Permalink
types: add slot typing for link and view
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Oct 14, 2021
1 parent 7385fdc commit 1b28dd4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/RouterLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
computed,
reactive,
unref,
VNode,
UnwrapRef,
VNodeProps,
AllowedComponentProps,
ComponentCustomProps,
Expand Down Expand Up @@ -254,6 +256,10 @@ export const RouterLink = RouterLinkImpl as unknown as {
ComponentCustomProps &
VNodeProps &
RouterLinkProps

$slots: {
default: (arg: UnwrapRef<ReturnType<typeof useLink>>) => VNode[]
}
}

/**
Expand Down
10 changes: 9 additions & 1 deletion src/RouterView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ComponentCustomProps,
watch,
Slot,
VNode,
} from 'vue'
import {
RouteLocationNormalized,
Expand Down Expand Up @@ -190,12 +191,19 @@ function normalizeSlot(slot: Slot | undefined, data: any) {
/**
* Component to display the current route the user is at.
*/
export const RouterView = RouterViewImpl as {
export const RouterView = RouterViewImpl as unknown as {
new (): {
$props: AllowedComponentProps &
ComponentCustomProps &
VNodeProps &
RouterViewProps

$slots: {
default: (arg: {
Component: VNode
route: RouteLocationNormalizedLoaded
}) => VNode[]
}
}
}

Expand Down

0 comments on commit 1b28dd4

Please sign in to comment.