// route records
RouteRecordInfo,
RouteRecordName,
- RouteRecordNameGeneric,
_RouteRecordProps,
RouteRecordRedirectOption,
import type {
RouteLocation,
RouteLocationRaw,
- RouteRecordName,
RouteParams,
RouteLocationNormalized,
RouteLocationNormalizedLoaded,
RouteLocationAsRelative,
RouteLocationAsPath,
RouteLocationAsString,
+ RouteRecordName,
} from './typed-routes'
import { RouterHistory, HistoryState, NavigationType } from './history/common'
import {
* @param route - Route Record to add
*/
addRoute(
+ // NOTE: RouteRecordName could be `keyof RouteMap` but the point of dynamic routes is not knowing the routes at build
parentName: NonNullable<RouteRecordName>,
route: RouteRecordRaw
): () => void
*
* @param name - Name of the route to remove
*/
- removeRoute(name: RouteRecordName): void
+ removeRoute(name: NonNullable<RouteRecordName>): void
/**
* Checks if a route with a given name exists
*
import type { RouteMap, RouteMapGeneric } from './route-map'
import type { Router } from '../router'
import type { RouteRecord, RouteRecordNormalized } from '../matcher/types'
-import type { RouteRecordName, RouteRecordNameGeneric } from './route-records'
+import type { RouteRecordName } from './route-records'
/**
* Generic version of {@link RouteLocation}. It is used when no {@link RouteMap} is provided.
* Generic version of {@link RouteLocationNormalized} that is used when no {@link RouteMap} is provided.
*/
export interface RouteLocationNormalizedGeneric extends _RouteLocationBase {
- name: RouteRecordNameGeneric
+ name: RouteRecordName
params: RouteParamsGeneric
/**
* Array of {@link RouteRecordNormalized}
RouteLocationNormalized,
RouteLocationRaw,
} from './route-location'
-import type { RouteMap, RouteMapGeneric } from './route-map'
+import type { RouteMap } from './route-map'
/**
* @internal
/**
* Possible values for a route record **after normalization**
- */
-export type RouteRecordNameGeneric = string | symbol | undefined
-
-/**
- * Possible values for a user-defined route record's name.
*
- * NOTE: since `RouteRecordName` is a type, it evaluates too early and it's always be {@link RouteRecordNameGeneric}. If you need a typed version use {@link RouteMap | `keyof RouteMap`}
+ * NOTE: since `RouteRecordName` is a type, it evaluates too early and it's always be a generic version. If you need a typed version of all of the names of routes, use {@link RouteMap | `keyof RouteMap`}
*/
-export type RouteRecordName = RouteMapGeneric extends RouteMap
- ? RouteRecordNameGeneric
- : keyof RouteMap
+export type RouteRecordName = string | symbol | undefined
/**
* @internal
import type {
NavigationGuardWithThis,
RouteLocation,
- RouteRecordName,
RouteRecordRedirectOption,
_RouteRecordProps,
- RouteRecordNameGeneric,
+ RouteRecordName,
} from '../typed-routes'
import type { _Awaitable } from './utils'
* @internal
*/
export interface LocationAsRelativeRaw {
- name?: RouteRecordNameGeneric
+ name?: RouteRecordName
// to allow checking location.path == null
/**
* Ignored path property since we are dealing with a relative location. Only `undefined` is allowed.