Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

location.ts

51 lines1.4 KB

1import type { ParsedHistoryState } from '@tanstack/history'
2import type { AnySchema } from './validators'
3​
4export interface ParsedLocation<TSearchObj extends AnySchema = {}> {
5 /**
6 * The full path of the location, including pathname, search, and hash.
7 * Does not include the origin. Is the equivalent of calling
8 * `url.replace(url.origin, '')`
9 */
10 href: string
11 /**
12 * @description The pathname of the location, including the leading slash.
13 */
14 pathname: string
15 /**
16 * The parsed search parameters of the location in object form.
17 */
18 search: TSearchObj
19 /**
20 * The search string of the location, including the leading question mark.
21 */
22 searchStr: string
23 /**
24 * The in-memory state of the location as it *may* exist in the browser's history.
25 */
26 state: ParsedHistoryState
27 /**
28 * The hash of the location, excluding the leading hash character.
29 * (e.g., '123' instead of '#123')
30 */
31 hash: string
32 /**
33 * The masked location of the location.
34 */
35 maskedLocation?: ParsedLocation<TSearchObj>
36 /**
37 * Whether to unmask the location on reload.
38 */
39 unmaskOnReload?: boolean
40 /**
41 * @private
42 * @description The public href of the location.
43 * If a rewrite is applied, the `href` property will be the rewritten URL.
44 */
45 publicHref: string
46 /**
47 * @private
48 * @description Whether the publicHref is external (different origin from rewrite).
49 */
50 external: boolean