]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: remove unused type
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 31 Jan 2020 18:07:34 +0000 (19:07 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 31 Jan 2020 18:07:34 +0000 (19:07 +0100)
__tests__/extractComponentsGuards.spec.ts
src/matcher/index.ts

index ca3c1667277523ca157109dc3f499d4440b788e3..d274e4036e179026be9cf13cb91e3a1ef15d2053 100644 (file)
@@ -1,14 +1,7 @@
 import { extractComponentsGuards } from '../src/utils'
-import {
-  START_LOCATION_NORMALIZED,
-  RouteRecord,
-  MatchedRouteRecord,
-} from '../src/types'
+import { START_LOCATION_NORMALIZED, RouteRecord } from '../src/types'
 import { components, normalizeRouteRecord } from './utils'
-
-/** @typedef {import('../src/types').RouteRecord} RouteRecord */
-/** @typedef {import('../src/types').MatchedRouteRecord} MatchedRouteRecord */
-/** @typedef {import('../src/types').RouteRecordRedirect} RouteRecordRedirect */
+import { RouteRecordMatched } from '../src/matcher/types'
 
 const beforeRouteEnter = jest.fn()
 
@@ -31,7 +24,7 @@ const SingleGuardNamed: RouteRecord = {
 
 function makeAsync(
   record: Exclude<RouteRecord, { redirect: any }>
-): MatchedRouteRecord {
+): RouteRecordMatched {
   if ('components' in record) {
     const copy = { ...record }
     copy.components = Object.keys(record.components).reduce(
@@ -42,18 +35,21 @@ function makeAsync(
       },
       {} as typeof record['components']
     )
-    return copy
+    return normalizeRouteRecord(copy)
   } else {
     const { component, ...copy } = record
     if (typeof component === 'function')
-      return { ...copy, components: { default: component } }
+      return normalizeRouteRecord({
+        ...copy,
+        components: { default: component },
+      })
 
-    return {
+    return normalizeRouteRecord({
       ...copy,
       components: {
         default: () => Promise.resolve(component),
       },
-    }
+    })
   }
 }
 
index f63ab7e287659aa83d96b6137df5758d455e8a06..d2b089dec676f3e4f378b631b09d1dd6c702ec65 100644 (file)
@@ -3,8 +3,6 @@ import {
   MatcherLocation,
   MatcherLocationNormalized,
   MatcherLocationRedirect,
-  // TODO: add it to matched
-  // MatchedRouteRecord,
 } from '../types'
 import { NoRouteMatchError, InvalidRouteMatch } from '../errors'
 import { createRouteRecordMatcher, RouteRecordMatcher } from './path-matcher'