@tanstack/react-router 1.15.23 → 1.16.2

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.
package/src/path.ts CHANGED
@@ -173,7 +173,7 @@ export function matchPathname(
173
173
  }
174
174
 
175
175
  export function removeBasepath(basepath: string, pathname: string) {
176
- return basepath != '/' ? pathname.substring(basepath.length) : pathname
176
+ return basepath != '/' ? pathname.replace(basepath, '') : pathname
177
177
  }
178
178
 
179
179
  export function matchByPath(
@@ -184,7 +184,8 @@ export function matchByPath(
184
184
  // Remove the base path from the pathname
185
185
  from = removeBasepath(basepath, from)
186
186
  // Default to to $ (wildcard)
187
- const to = `${matchLocation.to ?? '$'}`
187
+ const to = removeBasepath(basepath, `${matchLocation.to ?? '$'}`)
188
+
188
189
  // Parse the from and to
189
190
  const baseSegments = parsePathname(from)
190
191
  const routeSegments = parsePathname(to)
package/src/router.ts CHANGED
@@ -841,7 +841,7 @@ export class Router<
841
841
  let nextParams =
842
842
  (dest.params ?? true) === true
843
843
  ? prevParams
844
- : {...prevParams, ...functionalUpdate(dest.params!, prevParams)}
844
+ : { ...prevParams, ...functionalUpdate(dest.params!, prevParams) }
845
845
 
846
846
  if (nextParams) {
847
847
  matches
package/src/utils.ts CHANGED
@@ -34,13 +34,16 @@ export type DeepPartial<T> = T extends object
34
34
  }
35
35
  : T
36
36
 
37
- export type MakeDifferenceOptional<T, U> = Omit<U, keyof T> & Partial<Pick<U, keyof T & keyof U>> & PickRequired<Omit<U, keyof PickRequired<T>>>
37
+ export type MakeDifferenceOptional<T, U> = Omit<U, keyof T> &
38
+ Partial<Pick<U, keyof T & keyof U>> &
39
+ PickRequired<Omit<U, keyof PickRequired<T>>>
38
40
 
39
41
  // from https://stackoverflow.com/a/53955431
40
- export type IsUnion<T, U extends T = T> =
41
- (T extends any ?
42
- (U extends T ? false : true)
43
- : never) extends false ? false : true
42
+ export type IsUnion<T, U extends T = T> = (
43
+ T extends any ? (U extends T ? false : true) : never
44
+ ) extends false
45
+ ? false
46
+ : true
44
47
 
45
48
  // type Compute<T> = { [K in keyof T]: T[K] } | never
46
49