]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor types
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 5 Apr 2019 09:08:00 +0000 (11:08 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 5 Apr 2019 09:08:00 +0000 (11:08 +0200)
src/history/base.ts
src/history/html5.ts
src/types/index.ts

index 763d936fcbbc1d0879a181e92038976490b8ad95..007749e31b500e06f077b3eac01d109c577b2ef8 100644 (file)
@@ -1,10 +1,41 @@
-import {
-  START,
-  HistoryLocation,
-  NavigationCallback,
-  RemoveListener,
-  HistoryURL,
-} from '../types/index'
+export type HistoryLocation = string
+export interface HistoryURL {
+  path: string
+  search: Record<string, string>
+  hash: string
+}
+
+// pushState clones the state passed and do not accept everything
+// it doesn't accept symbols, nor functions. It also ignores Symbols as keys
+type HistoryStateValue =
+  | string
+  | number
+  | boolean
+  | HistoryState
+  | HistoryStateArray
+export interface HistoryState {
+  [x: number]: HistoryStateValue
+  [x: string]: HistoryStateValue
+}
+interface HistoryStateArray extends Array<HistoryStateValue> {}
+// export type HistoryState = Record<string | number, string | number | boolean | undefined | null |
+
+export const START: HistoryLocation = '/'
+
+export enum NavigationType {
+  back,
+  forward,
+}
+
+export interface NavigationCallback {
+  (
+    to: HistoryLocation,
+    from: HistoryLocation,
+    info: { type: NavigationType }
+  ): void
+}
+
+export type RemoveListener = () => void
 
 export default abstract class BaseHistory {
   // previousState: object
index 7134646c45ae1284c4a21e5c600215d4aff56eb0..8214e01ae1142ec0be5bbffd86ceb264f97f31c8 100644 (file)
@@ -6,7 +6,7 @@ import {
   HistoryState,
   NavigationType,
   HistoryURL,
-} from '../types/index'
+} from './base'
 
 const cs = consola.withTag('html5')
 
index ea5c807059447249ce503a66be7dc346add14b42..e29cac3a340801056702de04ea4e3fe7e466833d 100644 (file)
@@ -53,29 +53,6 @@ export interface RouterLocationNormalized {
   hash: string
 }
 
-export type HistoryLocation = string
-export interface HistoryURL {
-  path: string
-  search: Record<string, string>
-  hash: string
-}
-
-// pushState clones the state passed and do not accept everything
-// it doesn't accept symbols, nor functions. It also ignores Symbols as keys
-type HistoryStateValue =
-  | string
-  | number
-  | boolean
-  | HistoryState
-  | HistoryStateArray
-export interface HistoryState {
-  [x: number]: HistoryStateValue
-  [x: string]: HistoryStateValue
-}
-interface HistoryStateArray extends Array<HistoryStateValue> {}
-// export type HistoryState = Record<string | number, string | number | boolean | undefined | null |
-
-export const START: HistoryLocation = '/'
 export const START_RECORD: RouteRecord = {
   path: '/',
   // @ts-ignore
@@ -89,18 +66,3 @@ export const START_LOCATION_NORMALIZED: RouterLocationNormalized = {
   hash: '',
   fullPath: '/',
 }
-
-export enum NavigationType {
-  back,
-  forward,
-}
-
-export interface NavigationCallback {
-  (
-    to: HistoryLocation,
-    from: HistoryLocation,
-    info: { type: NavigationType }
-  ): void
-}
-
-export type RemoveListener = () => void