]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: remove usage of old base
authorEduardo San Martin Morote <posva13@gmail.com>
Sat, 12 Oct 2019 14:55:12 +0000 (16:55 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Sat, 12 Oct 2019 14:55:12 +0000 (16:55 +0200)
__tests__/history/abstract.spec.ts
src/history/common.ts
src/types/index.ts

index 040f407d728f828680e3f8b41e071e84448b2e81..83dcdf2af8734a5b3b72cb86c08dc18dfa0135fd 100644 (file)
@@ -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)
index d656f22673bc3d77c785ca5138ca2fd0861236ba..e4f7cccac7662efbbbe3bc1e6579e143a57156bd 100644 (file)
@@ -1,12 +1,12 @@
 import { ListenerRemover } from '../types'
 
-type HistoryQuery = Record<string, string | string[]>
+export type HistoryQuery = Record<string, string | string[]>
 // 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<string, string | string[] | null>
+export type RawHistoryQuery = Record<string, string | string[] | null>
 
 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<HistoryLocation> {
   // full path (like href)
index bd5c490c677fc6e6d007ee915495219018f28b1c..e291717e55258f196b6db344f74bf1d1eccfbddc 100644 (file)
@@ -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<Vue> | typeof Vue | AsyncComponent