Skip to content

Commit 4a0cc8b

Browse files
xiaoxiangmoeposva
andauthored
feat(types): improve link and view slots (#1544)
Co-authored-by: Eduardo San Martin Morote <[email protected]>
1 parent 3fe8f81 commit 4a0cc8b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

packages/router/src/RouterLink.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ export function useLink(props: UseLinkOptions) {
174174
}
175175
}
176176

177+
/**
178+
* NOTE: update {@link _RouterLinkI}'s `$slots` type when updating this
179+
*/
177180
return {
178181
route,
179182
href: computed(() => route.value.href),
@@ -269,7 +272,13 @@ export interface _RouterLinkI {
269272
RouterLinkProps
270273

271274
$slots: {
272-
default: (arg: UnwrapRef<ReturnType<typeof useLink>>) => VNode[]
275+
default?: ({
276+
route,
277+
href,
278+
isActive,
279+
isExactActive,
280+
navigate,
281+
}: UnwrapRef<ReturnType<typeof useLink>>) => VNode[]
273282
}
274283
}
275284

packages/router/src/RouterView.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,10 @@ export const RouterView = RouterViewImpl as unknown as {
224224
RouterViewProps
225225

226226
$slots: {
227-
default: (arg: {
227+
default?: ({
228+
Component,
229+
route,
230+
}: {
228231
Component: VNode
229232
route: RouteLocationNormalizedLoaded
230233
}) => VNode[]

0 commit comments

Comments
 (0)