Skip to content

Commit 1b28dd4

Browse files
committed
types: add slot typing for link and view
1 parent 7385fdc commit 1b28dd4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/RouterLink.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
computed,
77
reactive,
88
unref,
9+
VNode,
10+
UnwrapRef,
911
VNodeProps,
1012
AllowedComponentProps,
1113
ComponentCustomProps,
@@ -254,6 +256,10 @@ export const RouterLink = RouterLinkImpl as unknown as {
254256
ComponentCustomProps &
255257
VNodeProps &
256258
RouterLinkProps
259+
260+
$slots: {
261+
default: (arg: UnwrapRef<ReturnType<typeof useLink>>) => VNode[]
262+
}
257263
}
258264

259265
/**

src/RouterView.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ComponentCustomProps,
1414
watch,
1515
Slot,
16+
VNode,
1617
} from 'vue'
1718
import {
1819
RouteLocationNormalized,
@@ -190,12 +191,19 @@ function normalizeSlot(slot: Slot | undefined, data: any) {
190191
/**
191192
* Component to display the current route the user is at.
192193
*/
193-
export const RouterView = RouterViewImpl as {
194+
export const RouterView = RouterViewImpl as unknown as {
194195
new (): {
195196
$props: AllowedComponentProps &
196197
ComponentCustomProps &
197198
VNodeProps &
198199
RouterViewProps
200+
201+
$slots: {
202+
default: (arg: {
203+
Component: VNode
204+
route: RouteLocationNormalizedLoaded
205+
}) => VNode[]
206+
}
199207
}
200208
}
201209

0 commit comments

Comments
 (0)