]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix(types): explicit types on navigate
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 10 Sep 2020 15:40:28 +0000 (17:40 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 10 Sep 2020 15:40:28 +0000 (17:40 +0200)
src/RouterLink.ts

index ca7d6acdbf66f0630234905c41a59531c587d209..9fb714f55b8fa50d28a560130cac8781d62d72e2 100644 (file)
@@ -15,6 +15,7 @@ import { isSameRouteLocationParams, isSameRouteRecord } from './location'
 import { routerKey, routeLocationKey } from './injectionSymbols'
 import { RouteRecord } from './matcher/types'
 import { assign } from './utils'
+import { NavigationFailure } from './errors'
 
 export interface RouterLinkOptions {
   /**
@@ -107,7 +108,9 @@ export function useLink(props: UseLinkOptions) {
       isSameRouteLocationParams(currentRoute.params, route.value.params)
   )
 
-  function navigate(e: MouseEvent = {} as MouseEvent) {
+  function navigate(
+    e: MouseEvent = {} as MouseEvent
+  ): Promise<void | NavigationFailure> {
     if (guardEvent(e))
       return router[unref(props.replace) ? 'replace' : 'push'](unref(props.to))
     return Promise.resolve()