]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
types: add slot typing for link and view
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 14 Oct 2021 13:34:49 +0000 (15:34 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 14 Oct 2021 13:34:49 +0000 (15:34 +0200)
src/RouterLink.ts
src/RouterView.ts

index 236e98fe0b5b65b85e178dff4f8b273e81569ae2..5c788ba36207d57696d291df8ed2a38bcaf83af8 100644 (file)
@@ -6,6 +6,8 @@ import {
   computed,
   reactive,
   unref,
+  VNode,
+  UnwrapRef,
   VNodeProps,
   AllowedComponentProps,
   ComponentCustomProps,
@@ -254,6 +256,10 @@ export const RouterLink = RouterLinkImpl as unknown as {
       ComponentCustomProps &
       VNodeProps &
       RouterLinkProps
+
+    $slots: {
+      default: (arg: UnwrapRef<ReturnType<typeof useLink>>) => VNode[]
+    }
   }
 
   /**
index f891d3cbb7ea4e18ae023edff836db9bb89ba1f0..027d674606e16d2108904a8bc9b9e951a583824d 100644 (file)
@@ -13,6 +13,7 @@ import {
   ComponentCustomProps,
   watch,
   Slot,
+  VNode,
 } from 'vue'
 import {
   RouteLocationNormalized,
@@ -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[]
+    }
   }
 }