]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: remove old types
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 5 May 2022 14:45:11 +0000 (16:45 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Thu, 30 Jun 2022 07:59:00 +0000 (09:59 +0200)
src/index.ts
src/types/index.ts
src/types/named.ts

index 9ee95adfe5844749b42717ba730243fcd1f36e88..74b28e130e387c963fbfba67c0ae7f7e226d0eba 100644 (file)
@@ -47,9 +47,6 @@ export type {
   RouteLocationMatched,
   RouteLocationOptions,
   RouteRecordRedirectOption,
-  NamedLocationMap,
-  ExtractNamedRoutes,
-  ExtractRoutes,
   // route records
   _RouteRecordBase,
   RouteMeta,
index fc5d7b13590b476d6904fbe7000994e9ec9cee55..fd7ef405205cc869e51b3d55bafdb8fa3c8825b9 100644 (file)
@@ -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<T> = () => Promise<T>
 export type Override<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U
 
index 9b981a31d5df679e249c5dcc61452fdb1311f261..69a8afc78683d6b0d44b1d52e1f9ab95c94c0d37 100644 (file)
@@ -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> = [T] extends [ReadonlyArray<infer U>]
-  ? ExtractNamedRoutes<RouteFix<U>>
-  : ([T] extends [{ name: string }] ? { [K in T['name']]: unknown } : {}) &
-      ([T] extends [{ children?: undefined | unknown | any }]
-        ? T['children'] extends undefined
-          ? {}
-          : ExtractNamedRoutes<T['children']>
-        : {})
-
-// Needed to populate the missing props
-type RouteFix<T> = 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<T extends Router> = 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<RouteRecordRaw[]>,
   Prefix extends string = ''