]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor(types): prefix matcher types
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 14 Jun 2022 13:49:18 +0000 (15:49 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Thu, 30 Jun 2022 07:59:00 +0000 (09:59 +0200)
packages/router/src/index.ts
packages/router/src/types/index.ts

index e25726ed04eb14656ba99b59c5eec6ec053e60b3..0502e1ee6703cc5d35212aece1d8a9649e5cc9ec 100644 (file)
@@ -33,7 +33,7 @@ export { START_LOCATION_NORMALIZED as START_LOCATION } from './types'
 export type {
   // route location
   _RouteLocationBase,
-  LocationAsPath,
+  MatcherLocationAsPath,
   LocationAsRelativeRaw,
   RouteQueryAndHash,
   RouteLocationRaw,
index f265b2c264f94c7bd2cee3fe25cbcf1ce9171179..851b4d8aa91f4961a43b0c75afd56d5c2f1be52b 100644 (file)
@@ -58,14 +58,14 @@ export interface RouteQueryAndHash {
 /**
  * @internal
  */
-export interface LocationAsPath<P extends string = string> {
+export interface MatcherLocationAsPath<P extends string = string> {
   path: P
 }
 
 /**
  * @internal
  */
-export interface LocationAsName {
+export interface MatcherLocationAsName {
   name: RouteRecordName
   params?: RouteParams
 }
@@ -86,7 +86,7 @@ export interface LocationAsRelativeRaw<
 /**
  * @internal
  */
-export interface LocationAsRelative<
+export interface MatcherLocationAsRelative<
   Info extends RouteNamedInfo = RouteNamedInfo
 > {
   params?: Info extends RouteNamedInfo<any, infer Params, any>
@@ -167,11 +167,11 @@ export type RouteLocationNamedRaw<
 export type RouteLocationPathRaw<
   RouteMap extends RouteStaticPathMapGeneric = RouteStaticPathMapGeneric
 > = RouteStaticPathMapGeneric extends RouteMap
-  ? // allows assigning a RouteLocationRaw to RouteLocationPat
-    RouteQueryAndHash & LocationAsPath & RouteLocationOptions
+  ? // allows assigning a RouteLocationRaw to RouteLocationPath
+    RouteQueryAndHash & MatcherLocationAsPath & RouteLocationOptions
   : RouteQueryAndHash &
       RouteLocationOptions &
-      LocationAsPath<
+      MatcherLocationAsPath<
         LiteralUnion<
           { [K in keyof RouteMap]: RouteMap[K] }[keyof RouteMap],
           string
@@ -467,11 +467,17 @@ export const START_LOCATION_NORMALIZED: RouteLocationNormalizedLoaded = {
 
 // Matcher types
 // the matcher doesn't care about query and hash
+/**
+ * Route location that can be passed to the matcher.
+ */
 export type MatcherLocationRaw =
-  | LocationAsPath
-  | LocationAsName
-  | LocationAsRelative
+  | MatcherLocationAsPath
+  | MatcherLocationAsName
+  | MatcherLocationAsRelative
 
+/**
+ * Normalized/resolved Route location that returned by the matcher.
+ */
 export interface MatcherLocation {
   /**
    * Name of the matched record