Repository: remix-run/react-router
File: packages/react-router/lib/types/route-module-annotations.ts (TypeScript)

Code before:
import type { Pretty } from "./utils";

type MaybePromise<T> = T | Promise<T>;

type Props = {
  params: unknown;
  loaderData: unknown;
  actionData: unknown;
};

type RouteInfo = Props & {
  module: RouteModule;
  matches: Array<MatchInfo>;
};

type MatchInfo = {
  id: string;
  module: RouteModule;
};

type MetaMatch<T extends MatchInfo> = Pretty<{
  id: T["id"];
  params: Record<string, string | undefined>;
  pathname: string;
  meta: MetaDescriptor[];
  /** @deprecated Use `loaderData` instead */
  data: GetLoaderData<T["module"]>;
  loaderData: GetLoaderData<T["module"]>;
  handle?: unknown;
  error?: unknown;
}>;

// prettier-ignore
type MetaMatches<T extends Array<MatchInfo>> =
  T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>]
    ? [MetaMatch<F>, ...MetaMatches<R>]
    : Array<MetaMatch<MatchInfo> | undefined>;

type CreateMetaArgs<T extends RouteInfo> = {
  /** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
  location: Location;
  /** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
  params: T["params"];
  /**
   * The return value for this route's server loader function
   *
   * @deprecated Use `loaderData` instead
   */
  data: T["loaderData"] | undefined;
  /** The return value for this route's server loader function */
  loaderData: T["loaderData"] | undefined;

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

Code after:
import type { Pretty } from "./utils";

type MaybePromise<T> = T | Promise<T>;

type Props = {
  params: unknown;
  loaderData: unknown;
  actionData: unknown;
};

type RouteInfo = Props & {
  module: RouteModule;
  matches: Array<MatchInfo>;
};

type MatchInfo = {
  id: string;
  module: RouteModule;
};

type MetaMatch<T extends MatchInfo> = Pretty<{
  id: T["id"];
  params: Record<string, string | undefined>;
  pathname: string;
  meta: MetaDescriptor[];
  /** @deprecated Use `MetaMatch.loaderData` instead */
  data: GetLoaderData<T["module"]>;
  loaderData: GetLoaderData<T["module"]>;
  handle?: unknown;
  error?: unknown;
}>;

// prettier-ignore
type MetaMatches<T extends Array<MatchInfo>> =
  T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>]
    ? [MetaMatch<F>, ...MetaMatches<R>]
    : Array<MetaMatch<MatchInfo> | undefined>;

type CreateMetaArgs<T extends RouteInfo> = {
  /** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
  location: Location;
  /** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
  params: T["params"];
  /**
   * The return value for this route's server loader function
   *
   * @deprecated Use `Route.MetaArgs.loaderData` instead
   */
  data: T["loaderData"] | undefined;
  /** The return value for this route's server loader function */
  loaderData: T["loaderData"] | undefined;