From: Eduardo San Martin Morote Date: Tue, 14 Jun 2022 13:49:18 +0000 (+0200) Subject: refactor(types): prefix matcher types X-Git-Tag: v4.1.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3484c8b24cbea1e981b0f6d25614f76982997318;p=thirdparty%2Fvuejs%2Frouter.git refactor(types): prefix matcher types --- diff --git a/packages/router/src/index.ts b/packages/router/src/index.ts index e25726ed..0502e1ee 100644 --- a/packages/router/src/index.ts +++ b/packages/router/src/index.ts @@ -33,7 +33,7 @@ export { START_LOCATION_NORMALIZED as START_LOCATION } from './types' export type { // route location _RouteLocationBase, - LocationAsPath, + MatcherLocationAsPath, LocationAsRelativeRaw, RouteQueryAndHash, RouteLocationRaw, diff --git a/packages/router/src/types/index.ts b/packages/router/src/types/index.ts index f265b2c2..851b4d8a 100644 --- a/packages/router/src/types/index.ts +++ b/packages/router/src/types/index.ts @@ -58,14 +58,14 @@ export interface RouteQueryAndHash { /** * @internal */ -export interface LocationAsPath

{ +export interface MatcherLocationAsPath

{ 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 @@ -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