sveltejs / sveltejs/kit

Cannot pass params to `resolve` without `(group)`

Open
#14,529 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

types / typescript
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

(group) seems to be optional in resolve() as patched in https://github.com/sveltejs/kit/commit/1cd93cd7b29fde3c8d28a920bc9d02292ce8bbc7

However, the patch is incomplete and should be reverted.

<script>
  import { resolve } from '$app/paths';
</script>

<!-- 1: Works as expected. -->
<a href={resolve('/(group)/[slug]', { slug: 'hello' })}>label</a>

<!-- 2: Works as expected. -->
<!-- Expected 2 arguments, but got 1. js(2554) -->
<a href={resolve('/(group)/[slug]')}>label</a>

<!-- 3: Shouldn't this error? -->
<a href={resolve('/[slug]')}>label</a>

<!-- 4: This shows an incorrect error -->
<!-- Expected 1 arguments, but got 2. js(2554) -->
<a href={resolve('/[slug]', { slug: 'hello' })}>label</a>

More context:

Reproduction

https://github.com/hyunbinseo/svelte-kit-14529

System Info
System:
  OS: Windows 11 10.0.26100
  CPU: (8) x64 Intel(R) Core(TM) Ultra 7 258V
  Memory: 4.69 GB / 31.48 GB
Binaries:
  Node: 24.8.0 - ~\AppData\Local\fnm_multishells\32968_1758767770845\node.EXE
  Yarn: 1.22.22 - ~\AppData\Local\fnm_multishells\32968_1758767770845\yarn.CMD
  npm: 11.6.0 - ~\AppData\Local\fnm_multishells\32968_1758767770845\npm.CMD
  pnpm: 10.17.1 - ~\AppData\Local\fnm_multishells\32968_1758767770845\pnpm.CMD
Browsers:
  Edge: Chromium (140.0.3485.54)
npmPackages:
  @sveltejs/adapter-auto: ^6.0.0 => 6.1.0
  @sveltejs/kit: ^2.22.0 => 2.43.4
  @sveltejs/vite-plugin-svelte: ^6.0.0 => 6.2.1
  svelte: ^5.0.0 => 5.39.6
  vite: ^7.0.4 => 7.1.7
Severity

annoyance

Additional Information

No response

Contributor guide

Open the contributing guide

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 with the linked reproduction and inspect the $app/paths resolve entry point. Compare the four calls in the issue, especially route-group and dynamic-segment cases, then verify the resulting diagnostics against the examples so valid argument combinations work and invalid ones are rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.