Skip to content

RouteId is not a valid param for resolve() #15536

@marekdedic

Description

@marekdedic

Describe the bug

Hi, starting somewhere on 2.50+ (cannot remember exact version, sorry), I started getting strange errors, where a manually type RouteId cannot be passed as a first argument to resolve(), even though it should explicitly work with that as per the docs.

Reproduction

The linked Stackblitz doesn't boot, so a more full repro:

<script lang="ts">
  import type { RouteId } from "$app/types";

  import { goto } from "$app/navigation";
  import { resolve } from "$app/paths";

  void goto(
    resolve("whatever" as RouteId),
  );
</script>

Logs

I get this when running svelte-check:

Error: Argument of type '["/" | "/blog" | "/blog/hyperparameter-optimization-for-gnns-with-transfer-learning" | "/publications" | "/teaching" | "/teaching/LAL1" | "/teaching/LAL1/2021-winter" | ... 19 more ... | "/vyuka"]' is not assignable to parameter of type '[route: "/"] | [route: "/blog"] | [route: "/blog/hyperparameter-optimization-for-gnns-with-transfer-learning"] | [route: "/publications"] | [route: "/teaching"] | [route: "/teaching/LAL1"] | [route: "/teaching/LAL1/2021-winter"] | ... 19 more ... | [route: ...]'.
  Type '["/" | "/blog" | "/blog/hyperparameter-optimization-for-gnns-with-transfer-learning" | "/publications" | "/teaching" | "/teaching/LAL1" | "/teaching/LAL1/2021-winter" | ... 19 more ... | "/vyuka"]' is not assignable to type '[route: "/vyuka"]'.
    Type '"/" | "/blog" | "/blog/hyperparameter-optimization-for-gnns-with-transfer-learning" | "/publications" | "/teaching" | "/teaching/LAL1" | "/teaching/LAL1/2021-winter" | ... 19 more ... | "/vyuka"' is not assignable to type '"/vyuka"'.
      Type '"/"' is not assignable to type '"/vyuka"'. (ts)
      void goto(
        resolve(`/teaching/${course?.slug ?? ""}/${newVersion}` as RouteId),
      );

System Info

❯ npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"

  System:
    OS: Linux 6.17 Ubuntu 25.10 25.10 (Questing Quokka)
    CPU: (24) x64 AMD Ryzen AI 9 HX 370 w/ Radeon 890M
    Memory: 14.28 GB / 30.13 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 24.11.0 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 11.8.0 - /usr/bin/npm
    pnpm: 10.30.0 - /usr/bin/pnpm
  Browsers:
    Firefox: 148.0
    Firefox Developer Edition: 148.0
  npmPackages:
    @sveltejs/adapter-static: ^3.0.10 => 3.0.10
    @sveltejs/enhanced-img: ^0.10.3 => 0.10.3
    @sveltejs/kit: ^2.54.0 => 2.54.0
    @sveltejs/vite-plugin-svelte: ^6.2.4 => 6.2.4
    svelte: ^5.53.6 => 5.53.6
    vite: ^7.3.1 => 7.3.1

Severity

serious, but I can work around it

Additional Information

I was waiting for 2.54 and tried RouteIdWithSearchOrParams, but that doesn't fix it either.

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