From: Eduardo San Martin Morote Date: Thu, 5 May 2022 14:45:11 +0000 (+0200) Subject: refactor: remove old types X-Git-Tag: v4.1.0~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f78a6c7736dcad8ed9cac89c9e72efa444be0f4c;p=thirdparty%2Fvuejs%2Frouter.git refactor: remove old types --- diff --git a/src/index.ts b/src/index.ts index 9ee95adf..74b28e13 100644 --- a/src/index.ts +++ b/src/index.ts @@ -47,9 +47,6 @@ export type { RouteLocationMatched, RouteLocationOptions, RouteRecordRedirectOption, - NamedLocationMap, - ExtractNamedRoutes, - ExtractRoutes, // route records _RouteRecordBase, RouteMeta, diff --git a/src/types/index.ts b/src/types/index.ts index fc5d7b13..fd7ef405 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -6,8 +6,6 @@ import { HistoryState } from '../history/common' import { NavigationFailure } from '../errors' import { RouteNamedMapGeneric } from './named' -export { NamedLocationMap, ExtractNamedRoutes, ExtractRoutes } from './named' - export type Lazy = () => Promise export type Override = Pick> & U diff --git a/src/types/named.ts b/src/types/named.ts index 9b981a31..69a8afc7 100644 --- a/src/types/named.ts +++ b/src/types/named.ts @@ -1,51 +1,6 @@ import type { RouteParams, RouteParamsRaw, RouteRecordRaw } from '.' -import type { Router } from '../router' import type { JoinPath, ParamsFromPath, ParamsRawFromPath } from './paths' -/** - * This will flat the routes into an object with `key` === `router.name` - * and the value will be `unknown` since we don't have way to describe params types - */ -export type ExtractNamedRoutes = [T] extends [ReadonlyArray] - ? ExtractNamedRoutes> - : ([T] extends [{ name: string }] ? { [K in T['name']]: unknown } : {}) & - ([T] extends [{ children?: undefined | unknown | any }] - ? T['children'] extends undefined - ? {} - : ExtractNamedRoutes - : {}) - -// Needed to populate the missing props -type RouteFix = T extends { name: string; children: any } - ? T - : T extends { name: string } - ? T & { children: never } - : T extends { children: any } - ? T & { name: never } - : { name: never; children: never } - -export type ExtractRoutes = ExtractNamedRoutes< - T['options']['routes'] -> - -/** - * Used to define typed named locations - * @example - * ```ts - * declare module 'vue-router' { - * interface NamedLocationMap { - * // 'home' no params - * home: {} - * // 'product' `{id: string}` required parameter - * product: { - * id: string - * } - * } - * } - * ``` - */ -export interface NamedLocationMap {} - export type RouteNamedMap< Routes extends Readonly, Prefix extends string = ''