From: Eduardo San Martin Morote Date: Sat, 12 Oct 2019 14:55:12 +0000 (+0200) Subject: refactor: remove usage of old base X-Git-Tag: v4.0.0-alpha.0~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91e906cfbf70828a1f257e9d93403ba9e2a9cf11;p=thirdparty%2Fvuejs%2Frouter.git refactor: remove usage of old base --- diff --git a/__tests__/history/abstract.spec.ts b/__tests__/history/abstract.spec.ts index 040f407d..83dcdf2a 100644 --- a/__tests__/history/abstract.spec.ts +++ b/__tests__/history/abstract.spec.ts @@ -1,30 +1,32 @@ import createMemoryHistory from '../../src/history/abstract.2' -import { START } from '../../src/history/common' +import { + START, + HistoryLocationNormalized, + RawHistoryLocation, +} from '../../src/history/common' -/** @type {import('../../src/history/base').HistoryLocation} */ -const loc = { +const loc: RawHistoryLocation = { path: '/foo', } -const loc2 = { +const loc2: RawHistoryLocation = { path: '/bar', } -const normaliezedLoc = { +const normaliezedLoc: HistoryLocationNormalized = { path: '/foo', query: {}, hash: '', fullPath: '/foo', } -const normaliezedLoc2 = { +const normaliezedLoc2: HistoryLocationNormalized = { path: '/bar', query: {}, hash: '', fullPath: '/bar', } -// TODO: figure out how to run these tests now -describe('Abstract/in memory history', () => { +describe('Memory history', () => { it('starts in nowhere', () => { const history = createMemoryHistory() expect(history.location).toEqual(START) diff --git a/src/history/common.ts b/src/history/common.ts index d656f226..e4f7ccca 100644 --- a/src/history/common.ts +++ b/src/history/common.ts @@ -1,12 +1,12 @@ import { ListenerRemover } from '../types' -type HistoryQuery = Record +export type HistoryQuery = Record // TODO: is it reall worth allowing null to form queries like ?q&b&c // When parsing using URLSearchParams, `q&c=` yield an empty string for q and c // I think it's okay to allow this by default and allow extending it // a more permissive history query // TODO: allow numbers -type RawHistoryQuery = Record +export type RawHistoryQuery = Record interface HistoryLocation { // pathname section @@ -17,7 +17,7 @@ interface HistoryLocation { hash?: string } -type RawHistoryLocation = HistoryLocation | string +export type RawHistoryLocation = HistoryLocation | string export interface HistoryLocationNormalized extends Required { // full path (like href) diff --git a/src/types/index.ts b/src/types/index.ts index bd5c490c..e291717e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,4 +1,4 @@ -import { HistoryQuery, RawHistoryQuery } from '../history/base' +import { HistoryQuery, RawHistoryQuery } from '../history/common' // import Vue, { ComponentOptions, AsyncComponent } from 'vue' // type Component = ComponentOptions | typeof Vue | AsyncComponent