marko-js / marko-js/run

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

Open
#151 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
175
Forks
17
Avg merge
5h 26m
Merged PRs (30d)
5

Description

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>;
  }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the generator that produces .marko-run/routes.d.ts and inspect how route declarations, exported names, and union types are formatted. Compare its output with the diff-friendly example in the issue; done means generated declarations wrap long lines and remain valid TypeScript.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.