From: Eduardo San Martin Morote Date: Mon, 21 Jun 2021 08:55:07 +0000 (+0200) Subject: refactor(types): fix type error X-Git-Tag: v4.0.10~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bedd35089ee13ac254522aeb0c880bd4086f386a;p=thirdparty%2Fvuejs%2Frouter.git refactor(types): fix type error Close #1007 --- 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 {