]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix(router-link): add missing prop custom in jsx
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 3 Jul 2020 06:40:36 +0000 (08:40 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 3 Jul 2020 06:40:36 +0000 (08:40 +0200)
src/RouterLink.ts
src/history/common.ts
test-dts/components.test-d.tsx

index 82d6ac46ac303a148b936abbfbd9729c5092214d..c5d3d411be90d625ea5bb8829cce098f1881dfda 100644 (file)
@@ -14,13 +14,17 @@ import { routerKey, routeLocationKey } from './injectionSymbols'
 import { RouteRecord } from './matcher/types'
 import { assign } from './utils'
 
-export interface RouterLinkProps {
+export interface RouterLinkOptions {
   to: RouteLocationRaw
   // TODO: refactor using extra options allowed in router.push. Needs RFC
   replace?: boolean
 }
 
-type UseLinkOptions = VueUseOptions<RouterLinkProps>
+export interface RouterLinkProps extends RouterLinkOptions {
+  custom?: boolean
+}
+
+type UseLinkOptions = VueUseOptions<RouterLinkOptions>
 
 // TODO: we could allow currentRoute as a prop to expose `isActive` and
 // `isExactActive` behavior should go through an RFC
index 3120f62f32d6cc94013c6a302592dde11cf7bb14..2c7c8bc22179b3bae8e712a347b75bb199acdecf 100644 (file)
@@ -132,7 +132,7 @@ export interface RouterHistory {
   /**
    * Generates the corresponding href to be used in an anchor tag.
    *
-   * @param location
+   * @param location - history location that should create an href
    */
   createHref(location: HistoryLocationNormalized): string
 
index c8f58b017651ce844e6e7c914f81e9ae53ea1075..8ef2cbbe106632182a7e432233a7ed0f993a1a1f 100644 (file)
@@ -13,9 +13,12 @@ let router = createRouter({
 
 // RouterLink
 expectError(<RouterLink />)
+expectError(<RouterLink to="/" custom="text" />)
+expectError(<RouterLink to="/" replace="text" />)
 expectType<JSX.Element>(<RouterLink to="/foo" replace />)
 expectType<JSX.Element>(<RouterLink to="/foo" />)
 expectType<JSX.Element>(<RouterLink to={{ path: '/foo' }} />)
+expectType<JSX.Element>(<RouterLink to={{ path: '/foo' }} custom />)
 
 // RouterView
 expectType<JSX.Element>(<RouterView />)