Skip to content

Make .marko-run/routes.d.ts diff-able #151

Description

@vwong

Some lines of the generated .marko-run/routes.d.ts can be very long. This makes it wrap on small columns, and especially difficult to diff by a human.

Eg:

declare module "../src/routes/+layout.marko" {
  export interface Input extends Run.LayoutInput<typeof import("../src/routes/+layout.marko")> {}
  namespace MarkoRun {
    export { NotHandled, NotMatched, GetPaths, PostPaths, GetablePath, GetableHref, PostablePath, PostableHref, Platform };
    export type Route = Run.Routes["/aaaaa" | "/bbbbb" | "/ccccc" | "/ddddd" | "/eeeee" | "/fffff"];
    export type Context = Run.MultiRouteContext<Route> & Marko.Global;
    export type Handler = Run.HandlerLike<Route>;
    /** @deprecated use `((context, next) => { ... }) satisfies MarkoRun.Handler` instead */
    export const route: Run.HandlerTypeFn<Route>;
  }
}

Could perhaps be written as:

declare module "../src/routes/+layout.marko" {
  export interface Input
    extends Run.LayoutInput<typeof import("../src/routes/+layout.marko")> {}
  namespace MarkoRun {
    export {
      NotHandled,
      NotMatched,
      GetPaths,
      PostPaths,
      GetablePath,
      GetableHref,
      PostablePath,
      PostableHref,
      Platform,
    };
    export type Route = Run.Routes[
      | "/aaaaa"
      | "/bbbbb"
      | "/ccccc"
      | "/ddddd"
      | "/eeeee"
      | "/fffff"
    ];
    export type Context = Run.MultiRouteContext<Route> & Marko.Global;
    export type Handler = Run.HandlerLike<Route>;
    /** @deprecated use `((context, next) => { ... }) satisfies MarkoRun.Handler` instead */
    export const route: Run.HandlerTypeFn<Route>;
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions