From bedd35089ee13ac254522aeb0c880bd4086f386a Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 21 Jun 2021 10:55:07 +0200 Subject: [PATCH] refactor(types): fix type error Close #1007 --- src/RouterLink.ts | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/RouterLink.ts b/src/RouterLink.ts index 6be888bc..fdce3d1f 100644 --- a/src/RouterLink.ts +++ b/src/RouterLink.ts @@ -136,25 +136,26 @@ export function useLink(props: UseLinkOptions) { // devtools only if ((__DEV__ || __FEATURE_PROD_DEVTOOLS__) && isBrowser) { const instance = getCurrentInstance() - if (!instance) return - const linkContextDevtools: UseLinkDevtoolsContext = { - route: route.value, - isActive: isActive.value, - isExactActive: isExactActive.value, - } + if (instance) { + const linkContextDevtools: UseLinkDevtoolsContext = { + route: route.value, + isActive: isActive.value, + isExactActive: isExactActive.value, + } - // @ts-expect-error: this is internal - instance.__vrl_devtools = instance.__vrl_devtools || [] - // @ts-expect-error: this is internal - instance.__vrl_devtools.push(linkContextDevtools) - watchEffect( - () => { - linkContextDevtools.route = route.value - linkContextDevtools.isActive = isActive.value - linkContextDevtools.isExactActive = isExactActive.value - }, - { flush: 'post' } - ) + // @ts-expect-error: this is internal + instance.__vrl_devtools = instance.__vrl_devtools || [] + // @ts-expect-error: this is internal + instance.__vrl_devtools.push(linkContextDevtools) + watchEffect( + () => { + linkContextDevtools.route = route.value + linkContextDevtools.isActive = isActive.value + linkContextDevtools.isExactActive = isExactActive.value + }, + { flush: 'post' } + ) + } } return { -- 2.47.3