]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: remove old RouteLocation
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 10 Jun 2024 20:02:23 +0000 (22:02 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 10 Jun 2024 20:02:23 +0000 (22:02 +0200)
packages/router/src/location.ts
packages/router/src/typed-routes/index.ts
packages/router/src/typed-routes/route-location.ts
packages/router/src/typed-routes/route-records.ts
packages/router/src/types/index.ts

index 29fcb41ecd55f8be5c2344e17a23ef9df6ad7802..986939707475b1d16a7fcdb6b07270038fcfab3a 100644 (file)
@@ -1,14 +1,10 @@
 import { LocationQuery, LocationQueryRaw } from './query'
-import {
-  RouteLocation,
-  RouteLocationNormalized,
-  RouteParamValue,
-} from './types'
+import { RouteLocationNormalized, RouteParamValue } from './types'
 import { RouteRecord } from './matcher/types'
 import { warn } from './warning'
 import { isArray } from './utils'
 import { decode } from './encoding'
-import { RouteLocationNormalizedLoaded } from './typed-routes'
+import { RouteLocation, RouteLocationNormalizedLoaded } from './typed-routes'
 
 /**
  * Location object returned by {@link `parseURL`}.
index b88c0d4d0d2becc3346572748f7476e694547535..08b32445b42e64a79bc2e5a54bab9fe80c5ac43a 100644 (file)
@@ -10,7 +10,7 @@ export type { RouteRecordInfo } from './route-map'
 export type {
   _RouteRecordName as RouteRecordName,
   _RouteLocationRaw as RouteLocationRaw,
-  _RouteLocation as RouteLocation,
+  RouteLocation,
   _RouteLocationNormalized as RouteLocationNormalized,
   _RouteLocationNormalizedLoaded as RouteLocationNormalizedLoaded,
   _RouteLocationResolved as RouteLocationResolved,
index 2221db5dec845caa51fe9bd512ba7a973b3b4209..c405388af7aac482171386c7ad49523560dcbdd8 100644 (file)
@@ -1,16 +1,17 @@
 import type {
-  RouteLocation,
   RouteLocationNormalized,
   RouteLocationNormalizedLoaded,
   RouteLocationOptions,
   RouteQueryAndHash,
   RouteRecordName,
   RouteLocationRaw,
+  _RouteLocationBase,
 } from '../types'
 import type { _LiteralUnion } from '../types/utils'
 // inlining the type as it avoids code splitting issues
 import type { RouteMap, _RouteMapGeneric } from './route-map'
 import type { Router } from '../router'
+import type { RouteRecord } from '../matcher/types'
 
 /**
  * Type safe version if it exists of the routes' names.
@@ -24,9 +25,16 @@ export type _RouteRecordName = keyof RouteMap
 export interface RouteLocationTyped<
   RouteMap extends _RouteMapGeneric,
   Name extends keyof RouteMap
-> extends RouteLocation {
+> extends _RouteLocationBase {
   name: Extract<Name, RouteRecordName>
   params: RouteMap[Name]['params']
+
+  /**
+   * Array of {@link RouteRecord} containing components as they were
+   * passed when adding records. It can also contain redirect records. This
+   * can't be used directly
+   */
+  matched: RouteRecord[] // non-enumerable
 }
 
 /**
@@ -193,10 +201,10 @@ export type _RouteLocationResolved<
 > = RouteLocationResolvedTypedList<RouteMap>[Name]
 
 /**
- * Type safe version of `RouteLocation` . Allows passing the name of the route to be passed as a generic.
+ * {@link RouteLocationRaw} resolved using the matcher
  * @see {@link RouteLocation}
  */
-export type _RouteLocation<Name extends keyof RouteMap = keyof RouteMap> =
+export type RouteLocation<Name extends keyof RouteMap = keyof RouteMap> =
   RouteLocationTypedList<RouteMap>[Name]
 
 /**
index 1395f274d4f649678bc8ace0c39821d7ae66293d..3a6247e5ac319825add89663e321835471a16022 100644 (file)
@@ -1,8 +1,8 @@
-import { _RouteLocation, _RouteLocationRaw } from './route-location'
+import { RouteLocation, _RouteLocationRaw } from './route-location'
 
 /**
  * @internal
  */
 export type RouteRecordRedirectOption =
   | _RouteLocationRaw
-  | ((to: _RouteLocation) => _RouteLocationRaw)
+  | ((to: RouteLocation) => _RouteLocationRaw)
index 9bcc131d49d103ed621fde6a5ead975861349c27..c9337dcbdb512db42c22d48306ea54cb23a7eb70 100644 (file)
@@ -6,6 +6,7 @@ import { HistoryState } from '../history/common'
 import { NavigationFailure } from '../errors'
 import {
   NavigationGuardWithThis,
+  RouteLocation,
   RouteRecordRedirectOption,
 } from '../typed-routes'
 import { _Awaitable } from './utils'
@@ -193,18 +194,6 @@ export interface RouteLocationNormalizedLoaded extends _RouteLocationBase {
   matched: RouteLocationMatched[] // non-enumerable
 }
 
-/**
- * {@link RouteLocationRaw} resolved using the matcher
- */
-export interface RouteLocation extends _RouteLocationBase {
-  /**
-   * Array of {@link RouteRecord} containing components as they were
-   * passed when adding records. It can also contain redirect records. This
-   * can't be used directly
-   */
-  matched: RouteRecord[] // non-enumerable
-}
-
 /**
  * Similar to {@link RouteLocation} but its
  * {@link RouteLocationNormalized.matched} cannot contain redirect records