@tanstack/router-core 0.0.1-beta.185 → 0.0.1-beta.187

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ export type ScrollRestorationOptions = {
22
22
  getKey?: (location: ParsedLocation) => string
23
23
  }
24
24
 
25
- const defaultGetKey = (location: ParsedLocation) => location.key!
25
+ const defaultGetKey = (location: ParsedLocation) => location.state.key!
26
26
 
27
27
  export function watchScrollPositions(
28
28
  router: AnyRouter,
package/src/utils.ts CHANGED
@@ -31,21 +31,21 @@ export type UnionToIntersection<U> = (
31
31
  ? I
32
32
  : never
33
33
 
34
- type Compute<T> = { [K in keyof T]: T[K] } | never
35
-
36
- type AllKeys<T> = T extends any ? keyof T : never
37
-
38
- export type MergeUnion<T, Keys extends keyof T = keyof T> = Compute<
39
- {
40
- [K in Keys]: T[Keys]
41
- } & {
42
- [K in AllKeys<T>]?: T extends any
43
- ? K extends keyof T
44
- ? T[K]
45
- : never
46
- : never
47
- }
48
- >
34
+ // type Compute<T> = { [K in keyof T]: T[K] } | never
35
+
36
+ // type AllKeys<T> = T extends any ? keyof T : never
37
+
38
+ // export type MergeUnion<T, Keys extends keyof T = keyof T> = Compute<
39
+ // {
40
+ // [K in Keys]: T[Keys]
41
+ // } & {
42
+ // [K in AllKeys<T>]?: T extends any
43
+ // ? K extends keyof T
44
+ // ? T[K]
45
+ // : never
46
+ // : never
47
+ // }
48
+ // >
49
49
 
50
50
  export type Values<O> = O[ValueKeys<O>]
51
51
  export type ValueKeys<O> = Extract<keyof O, PropertyKey>
@@ -69,6 +69,10 @@ export type Updater<TPrevious, TResult = TPrevious> =
69
69
  | TResult
70
70
  | ((prev?: TPrevious) => TResult)
71
71
 
72
+ export type NonNullableUpdater<TPrevious, TResult = TPrevious> =
73
+ | TResult
74
+ | ((prev: TPrevious) => TResult)
75
+
72
76
  export type PickExtract<T, U> = {
73
77
  [K in keyof T as T[K] extends U ? K : never]: T[K]
74
78
  }
@@ -86,9 +90,9 @@ function isFunction(d: any): d is Function {
86
90
  }
87
91
 
88
92
  export function functionalUpdate<TResult>(
89
- updater: Updater<TResult>,
93
+ updater: Updater<TResult> | NonNullableUpdater<TResult>,
90
94
  previous: TResult,
91
- ) {
95
+ ): TResult {
92
96
  if (isFunction(updater)) {
93
97
  return updater(previous as TResult)
94
98
  }