path: string
}
+/**
+ * @internal
+ */
export interface LocationAsName {
name: RouteRecordName
params?: RouteParams
*
* @internal
*/
-export interface _RouteLocationBase {
- /**
- * Percentage encoded pathname section of the URL.
- */
- path: string
+export interface _RouteLocationBase
+ extends Pick<MatcherLocation, 'name' | 'path' | 'params' | 'meta'> {
/**
* The whole location including the `search` and `hash`. This string is
* percentage encoded.
* Hash of the current location. If present, starts with a `#`.
*/
hash: string
- /**
- * Name of the matched record
- */
- name: RouteRecordName | null | undefined
- /**
- * Object of decoded params extracted from the `path`.
- */
- params: RouteParams
/**
* Contains the location we were initially trying to access before ending up
* on the current location.
*/
redirectedFrom: RouteLocation | undefined
- /**
- * Merged `meta` properties from all of the matched route records.
- */
- meta: RouteMeta
}
// matched contains resolved components
| LocationAsName
| LocationAsRelative
-// TODO: should probably be the other way around: RouteLocationNormalized extending from MatcherLocation
-export interface MatcherLocation
- extends Pick<
- RouteLocation,
- 'name' | 'path' | 'params' | 'matched' | 'meta'
- > {}
+export interface MatcherLocation {
+ /**
+ * Name of the matched record
+ */
+ name: RouteRecordName | null | undefined
+
+ /**
+ * Percentage encoded pathname section of the URL.
+ */
+ path: string
+
+ /**
+ * Object of decoded params extracted from the `path`.
+ */
+ params: RouteParams
+
+ /**
+ * Merged `meta` properties from all of the matched route records.
+ */
+ meta: RouteMeta
+
+ /**
+ * 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
+}
export interface NavigationGuardNext {
(): void