Skip to content

Types are not properly updated for routes under group layouts #6842

@williamviktorsson

Description

@williamviktorsson

Describe the bug

When altering return values from actions / load functions in +page.server.(ts/js) , the corresponding types are automagically updated while running npm run dev.

This experience breaks for routes under layout groups.

Under layout groups, one seems to be required to run npx svelte-kit sync and restart the language server if running vscode to get the latest types.

When moving such routes with said issue, away from a layout group, the wonderful DX resumes.

Reproduction

This is a reproduction of the issue, taking the base demo-todo-app and putting all routes under a shared (groups) layout group.

Running the project and updating any return values from e.g. the (groups)/login/+page.server.js does not trigger an update in the generated types.

Moving the same route out of the (groups) layout group fixes the issue.

https://github.com/williamviktorsson/layout-groups-typing-bug

Logs

No response

System Info

System:
    OS: Windows 10 10.0.18363
    CPU: (4) x64 Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
    Memory: 2.03 GB / 7.92 GB
  Binaries:
    Node: 16.17.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.18.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 105.0.5195.102
    Edge: Spartan (44.18362.1533.0)
    Internet Explorer: 11.0.18362.1
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.75
    @sveltejs/kit: next => 1.0.0-next.483
    svelte: ^3.46.0 => 3.50.1
    vite: ^3.1.0 => 3.1.1

Severity

serious, but I can work around it

Additional Information

Layout groups reduce boilerplate code amongst other things, improving DX.

However, losing the great typing experience is a larger loss in DX.

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