Skip to content

VSCode shows error/any for generated types #2053

@probablykasper

Description

@probablykasper

Describe the bug

SvelteKit generated types often don't work correctly with VSCode. It could be a bigger issue than just with Locals, I'm not sure.

In my production repo I have a +layout.ts which receives
In the reproduction repo I have a +layout.ts which receives data from +layout.server.ts.

If I open +layout.ts in VSCode, it shows the data type as any:

{
    session: any;
}

Then if I open the +layout.server.ts, it shows the reason for that:
image

If I just update +layout.server.ts, the error goes away and the types are correct in both files.

Reproduction

Repo: https://github.com/probablykasper/sveltekit-generated-any

Screen.Recording.2023-06-12.at.07.32.37.mp4

Expected behaviour

The type error shouldn't happen. If some error like this does happen, it would be nice to avoid silently using any and instead provide some hint that there's an error somewhere

System Info

  • OS: [e.g. Windows]
  • IDE: [e.g. VSCode, Atom]

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

Tested with a fresh VSCode instance, with only the Svelte for VSCode extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions