Skip to content

typed-router.d.ts gives the Explorer route path as :path(.*)? but the router record is :path* #520

Closed

Description

@jaysuk

What I see

The generated, committed src/typed-router.d.ts (last changed in the 3.7.0-rc.1 release commit ada0a1b3) declares the Explorer route as:

'/Explorer/[[tab]]/[[volume]]/[[...path]]': RouteRecordInfo<
  '/Explorer/[[tab]]/[[volume]]/[[...path]]',
  '/Explorer/:tab?/:volume?/:path(.*)?',
  ...

At runtime on v3.7-dev (3.7.0-rc.2, vue-router ^5.2.0), router.getRoutes() lists the same record as /Explorer/:tab?/:volume?/:path*. I read this from DWC's own warning below, which prints the available record paths.

Why it matters

Route overrides are keyed by the record's canonical path string. registerLayout({ routes }) looks each key up with findPageRecord, which does router.getRoutes().find((r) => r.path === path && ...). A plugin author who copies the path from the typed route (the natural place to look, and the only place it is spelled out) gets:

[DWC] Cannot override route "/Explorer/:tab?/:volume?/:path(.*)?": no registered route matches that path. Available paths: /, /:notFound(.*), /BuiltInLayout, /Console, /Dashboard, /Explorer/:tab?/:volume?/:path*, ...

The override is skipped with only that console.warn, so the plugin looks fine and the override silently does nothing. A layout plugin (Flexible Layouts' opt-in Explorer replacement) was inert on rc.2 for this reason until it listed both spellings.

CUSTOM-LAYOUT.md tells authors to use "the strings you see in router.getRoutes().map(r => r.path)", which is right, but the typed file contradicts it for this route.

Related observation

src/pages/Explorer/[[tab]]/[[volume]]/[[...path]].vue already notes that vue-router's :path* catch-all returns an array of segments, so the code knows the record is :path*; only the generated typing differs. Params typed from the same declaration will also disagree in shape ((.*)? gives a string, * gives an array).

Suggestions

  • Regenerate typed-router.d.ts so the committed file matches what the router builds, if it is only stale.
  • If it is not stale (the typing generator and the runtime normaliser really disagree for [[...path]]), mention the difference in CUSTOM-LAYOUT.md next to the routes option, or have installRouteOverrides accept either spelling.

I have not checked other [[...x]] routes; /Jobs/:volume?/:path* in the same warning list follows the * form.

Environment

v3.7-dev at 8974abe9, DWC 3.7.0-rc.2, vue-router ^5.2.0, npm run dev.

Activity

  1. github-actions commented on Sep 29, 2026

    @github-actions

    This issue has been automatically closed because it does not originate from a Duet3D administrator.
    Please create a discussion on https://forum.duet3d.com first and fill out the corresponding GitHub template if the bug or feature request is acknowledged.

  2. chrishamm commented on Sep 29, 2026

    @chrishamm
    Collaborator

    Confirmed, but it is not stale. src/router/index.ts rewrote :path(.)? to :path on
    the compiled records after generation, so the generated file kept the pre-rewrite
    spelling for Explorer and Jobs. The param typing was wrong the same way, declared as
    a string where the runtime hands you a string[].

    Fixed by doing the rewrite in the generator instead, through the vite plugin's
    extendRoute hook. The generated records, typed-router.d.ts and the router now agree
    on :path*, and path is typed as ParamValueZeroOrMore. The fixCatchAllPath helper is
    gone. This will be in the next rc.

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