From: Eduardo San Martin Morote Date: Fri, 31 Jan 2020 18:07:34 +0000 (+0100) Subject: refactor: remove unused type X-Git-Tag: v4.0.0-alpha.0~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c5182ce55ca58fc4215524d83b607b32b232ab7b;p=thirdparty%2Fvuejs%2Frouter.git refactor: remove unused type --- diff --git a/__tests__/extractComponentsGuards.spec.ts b/__tests__/extractComponentsGuards.spec.ts index ca3c1667..d274e403 100644 --- a/__tests__/extractComponentsGuards.spec.ts +++ b/__tests__/extractComponentsGuards.spec.ts @@ -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 -): 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), }, - } + }) } } diff --git a/src/matcher/index.ts b/src/matcher/index.ts index f63ab7e2..d2b089de 100644 --- a/src/matcher/index.ts +++ b/src/matcher/index.ts @@ -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'