Skip to content

{ params } = $props() doesn't work #14011

@craig-jennings

Description

@craig-jennings

Describe the bug

#13999 added better typing for params that are used when destructuring the $props rune, however it appears this doesn't actually work. I get undefined when I $inspect params and the server 500s when I try to access a param.

Reproduction

  1. sv create test
    • Choose minimal option
    • Choose typescript option
    • Skip add-ons
    • Use pnpm
  2. Create a src/routes/[x]/+page.svelte file with the following content
<script>
	let { params } = $props();
</script>

<p>x: {params.x}</p>
  1. Run pnpm dev
  2. Navigate to http://localhost:5173/test
  3. Notice the server gives a 500 error TypeError: Cannot read properties of undefined (reading 'x')

Logs

System Info

System:
    OS: Linux 6.6 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 22.29 GB / 31.31 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 22.17.1 - ~/.nvm/versions/node/v22.17.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v22.17.1/bin/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v22.17.1/bin/npm
    pnpm: 10.13.1 - ~/.nvm/versions/node/v22.17.1/bin/pnpm
  npmPackages:
    @sveltejs/adapter-auto: ^6.0.0 => 6.0.1
    @sveltejs/kit: ^2.22.0 => 2.25.0
    @sveltejs/vite-plugin-svelte: ^6.0.0 => 6.1.0
    svelte: ^5.0.0 => 5.36.7
    vite: ^7.0.4 => 7.0.5

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions