Skip to content

Skip (group)s in Pathname/resolve #14044

@danieldiekmeier

Description

@danieldiekmeier

Describe the problem

Thank you for adding the new more type-safe routing features (https://svelte.dev/docs/kit/$app-types), they are much appreciated.

However, some of my apps use a few (group) paths (https://svelte.dev/docs/kit/advanced-routing#Advanced-layouts-(group)), which I am now forced to include in resolve calls. Before, I was able to skip it, since it evaluates to the same path anyway.

With a route like: /(admin)/dashboard/+page.svelte

// Before:
resolveRoute("/(admin)/dashboard") -> "/dashboard"
resolveRoute("/dashboard")         -> "/dashboard"

// Now:
resolve("/(admin)/dashboard")      -> "/dashboard"
resolve("/dashboard")              -> Type Error

This shortens the lines in the template and makes it easier to see where the link is going.

Describe the proposed solution

I would like to see versions of the paths with (group)s removed in the Pathname type.

I personally would even be okay if the (group) versions were dropped completely. At the moment, the existence of them allows weird situations like this:

resolve("/")                       -> "/"
resolve("/(admin)")                -> "/" Does not even use `(admin)/+layout.svelte` at all!

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions