Repository: remix-run/react-router
File: packages/react-router/lib/router/utils.ts (TypeScript)

Code before:
    // paths in the route definitions.  Memory router locations won't be
    // encoded here but there also shouldn't be anything to decode so this
    // should be a safe operation.  This avoids needing matchRoutes to be
    // history-aware.
    let decoded = decodePath(pathname);
    matches = matchRouteBranch<string, RouteObjectType>(
      branches[i],
      decoded,
      allowPartial,
    );
  }

  return matches;
}

export interface UIMatch<Data = unknown, Handle = unknown> {
  id: string;
  pathname: string;
  /**
   * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
   **/
  params: AgnosticRouteMatch["params"];
  /**
   * The return value from the matched route's loader or clientLoader
   *
   * @deprecated Use `loaderData` instead
   */
  data: Data;
  /** The return value from the matched route's loader or clientLoader */
  loaderData: Data;
  /** The {@link https://reactrouter.com/start/framework/route-module#handle handle object} exported from the matched route module */
  handle: Handle;
}

export function convertRouteMatchToUiMatch(
  match: AgnosticDataRouteMatch,
  loaderData: RouteData,
): UIMatch {
  let { route, pathname, params } = match;
  return {
    id: route.id,
    pathname,
    params,
    data: loaderData[route.id],
    loaderData: loaderData[route.id],
    handle: route.handle,
  };
}

interface RouteMeta<
  RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject,

Review comment (suggestion):
```suggestion
   * @deprecated Use `UIMatch.loaderData` instead
```

Code after:
    // paths in the route definitions.  Memory router locations won't be
    // encoded here but there also shouldn't be anything to decode so this
    // should be a safe operation.  This avoids needing matchRoutes to be
    // history-aware.
    let decoded = decodePath(pathname);
    matches = matchRouteBranch<string, RouteObjectType>(
      branches[i],
      decoded,
      allowPartial,
    );
  }

  return matches;
}

export interface UIMatch<Data = unknown, Handle = unknown> {
  id: string;
  pathname: string;
  /**
   * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
   **/
  params: AgnosticRouteMatch["params"];
  /**
   * The return value from the matched route's loader or clientLoader
   *
   * @deprecated Use `UIMatch.loaderData` instead
   */
  data: Data;
  /** The return value from the matched route's loader or clientLoader */
  loaderData: Data;
  /** The {@link https://reactrouter.com/start/framework/route-module#handle handle object} exported from the matched route module */
  handle: Handle;
}

export function convertRouteMatchToUiMatch(
  match: AgnosticDataRouteMatch,
  loaderData: RouteData,
): UIMatch {
  let { route, pathname, params } = match;
  return {
    id: route.id,
    pathname,
    params,
    data: loaderData[route.id],
    loaderData: loaderData[route.id],
    handle: route.handle,
  };
}

interface RouteMeta<
  RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject,