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, including the leading hash character.
29 */
30 hash: string
31 /**
32 * The masked location of the location.
33 */
34 maskedLocation?: ParsedLocation<TSearchObj>
35 /**
36 * Whether to unmask the location on reload.
37 */
38 unmaskOnReload?: boolean
39 /**
40 * @private
41 * @description The public href of the location, including the origin before any rewrites.
42 * If a rewrite is applied, the `href` property will be the rewritten URL.
43 */
44 publicHref: string
45 /**
46 * @private
47 * @description The full URL of the location, including the origin.
48 * @private
49 */
50 url: string