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

Code before:
  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;
  /** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
  error?: unknown;
  /** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
  matches: MetaMatches<T["matches"]>;
};
type MetaDescriptors = MetaDescriptor[];

type HeadersArgs = {
  loaderHeaders: Headers;
  parentHeaders: Headers;
  actionHeaders: Headers;
  errorHeaders: Headers | undefined;
};

type CreateServerMiddlewareFunction<T extends RouteInfo> = (
  args: ServerDataFunctionArgs<T["params"]>,
  next: unstable_MiddlewareNextFunction<Response>,
) => MaybePromise<Response | void>;

type CreateClientMiddlewareFunction<T extends RouteInfo> = (
  args: ClientDataFunctionArgs<T["params"]>,

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

Code after:
  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;
  /** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
  error?: unknown;
  /** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
  matches: MetaMatches<T["matches"]>;
};
type MetaDescriptors = MetaDescriptor[];

type HeadersArgs = {
  loaderHeaders: Headers;
  parentHeaders: Headers;
  actionHeaders: Headers;
  errorHeaders: Headers | undefined;
};

type CreateServerMiddlewareFunction<T extends RouteInfo> = (
  args: ServerDataFunctionArgs<T["params"]>,
  next: unstable_MiddlewareNextFunction<Response>,
) => MaybePromise<Response | void>;

type CreateClientMiddlewareFunction<T extends RouteInfo> = (
  args: ClientDataFunctionArgs<T["params"]>,