From: Eduardo San Martin Morote Date: Fri, 5 Apr 2019 09:08:00 +0000 (+0200) Subject: refactor types X-Git-Tag: v4.0.0-alpha.0~467 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50d4e4b0dc9af8cc21d98f8d97cfeb494a104787;p=thirdparty%2Fvuejs%2Frouter.git refactor types --- diff --git a/src/history/base.ts b/src/history/base.ts index 763d936f..007749e3 100644 --- a/src/history/base.ts +++ b/src/history/base.ts @@ -1,10 +1,41 @@ -import { - START, - HistoryLocation, - NavigationCallback, - RemoveListener, - HistoryURL, -} from '../types/index' +export type HistoryLocation = string +export interface HistoryURL { + path: string + search: Record + 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 {} +// export type HistoryState = Record void export default abstract class BaseHistory { // previousState: object diff --git a/src/history/html5.ts b/src/history/html5.ts index 7134646c..8214e01a 100644 --- a/src/history/html5.ts +++ b/src/history/html5.ts @@ -6,7 +6,7 @@ import { HistoryState, NavigationType, HistoryURL, -} from '../types/index' +} from './base' const cs = consola.withTag('html5') diff --git a/src/types/index.ts b/src/types/index.ts index ea5c8070..e29cac3a 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -53,29 +53,6 @@ export interface RouterLocationNormalized { hash: string } -export type HistoryLocation = string -export interface HistoryURL { - path: string - search: Record - 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 {} -// export type HistoryState = Record void