From 3484c8b24cbea1e981b0f6d25614f76982997318 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 14 Jun 2022 15:49:18 +0200 Subject: [PATCH] refactor(types): prefix matcher types --- packages/router/src/index.ts | 2 +- packages/router/src/types/index.ts | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) 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 -- 2.47.2