From 1b28dd428c691e4f454c9731d5bdbebc737e257f Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 14 Oct 2021 15:34:49 +0200 Subject: [PATCH] types: add slot typing for link and view --- src/RouterLink.ts | 6 ++++++ src/RouterView.ts | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/RouterLink.ts b/src/RouterLink.ts index 236e98fe0..5c788ba36 100644 --- a/src/RouterLink.ts +++ b/src/RouterLink.ts @@ -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>) => VNode[] + } } /** diff --git a/src/RouterView.ts b/src/RouterView.ts index f891d3cbb..027d67460 100644 --- a/src/RouterView.ts +++ b/src/RouterView.ts @@ -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[] + } } }