@@ -778,6 +778,10 @@ export interface ViewTransitionOptions {
778778}
779779
780780// TODO where is this used? can we remove this?
781+ /**
782+ * Convert an unknown error into a minimal, serializable object.
783+ * Includes name and message (and stack in development).
784+ */
781785export function defaultSerializeError ( err : unknown ) {
782786 if ( err instanceof Error ) {
783787 const obj = {
@@ -797,6 +801,7 @@ export function defaultSerializeError(err: unknown) {
797801 }
798802}
799803
804+ /** Options for configuring trailing-slash behavior. */
800805export const trailingSlashOptions = {
801806 always : 'always' ,
802807 never : 'never' ,
@@ -806,6 +811,10 @@ export const trailingSlashOptions = {
806811export type TrailingSlashOption =
807812 ( typeof trailingSlashOptions ) [ keyof typeof trailingSlashOptions ]
808813
814+ /**
815+ * Compute whether path, href or hash changed between previous and current
816+ * resolved locations in router state.
817+ */
809818export function getLocationChangeInfo ( routerState : {
810819 resolvedLocation ?: ParsedLocation
811820 location : ParsedLocation
@@ -2517,8 +2526,10 @@ export class RouterCore<
25172526 }
25182527}
25192528
2529+ /** Error thrown when search parameter validation fails. */
25202530export class SearchParamError extends Error { }
25212531
2532+ /** Error thrown when path parameter parsing/validation fails. */
25222533export class PathParamError extends Error { }
25232534
25242535const normalize = ( str : string ) =>
@@ -2527,9 +2538,10 @@ function comparePaths(a: string, b: string) {
25272538 return normalize ( a ) === normalize ( b )
25282539}
25292540
2530- // A function that takes an import() argument which is a function and returns a new function that will
2531- // proxy arguments from the caller to the imported function, retaining all type
2532- // information along the way
2541+ /**
2542+ * Lazily import a module function and forward arguments to it, retaining
2543+ * parameter and return types for the selected export key.
2544+ */
25332545export function lazyFn <
25342546 T extends Record < string , ( ...args : Array < any > ) => any > ,
25352547 TKey extends keyof T = 'default' ,
@@ -2542,6 +2554,7 @@ export function lazyFn<
25422554 }
25432555}
25442556
2557+ /** Create an initial RouterState from a parsed location. */
25452558export function getInitialRouterState (
25462559 location : ParsedLocation ,
25472560) : RouterState < any > {
@@ -2587,6 +2600,10 @@ function validateSearch(validateSearch: AnyValidator, input: unknown): unknown {
25872600 return { }
25882601}
25892602
2603+ /**
2604+ * Build the matched route chain and extract params for a pathname.
2605+ * Falls back to the root route if no specific route is found.
2606+ */
25902607export function getMatchedRoutes < TRouteLike extends RouteLike > ( {
25912608 pathname,
25922609 routePathname,
0 commit comments