Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte 5: Action parameters type inferred as 'any' despite explicit typing #13268

Open
colinlienard opened this issue Sep 16, 2024 · 0 comments

Comments

@colinlienard
Copy link

Describe the bug

When defining an Action with explicit parameter types, the compiler still infers the parameters as any, leading to type errors when accessing properties:

image

But this seems to happen only in the IDE because when running svelte-check there are no errors.

Reproduction

https://github.com/colinlienard/svelte-5-repro in src/App.svelte

Logs

Property 'foo' does not exist on type 'unknown'

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M2
    Memory: 505.70 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v20.11.0/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
    pnpm: 9.0.6 - ~/.nvm/versions/node/v20.11.0/bin/pnpm
    bun: 1.1.26 - ~/.nvm/versions/node/v20.11.0/bin/bun
  Browsers:
    Chrome: 128.0.6613.138
    Safari: 17.6
  npmPackages:
    svelte: 5.0.0-next.246 => 5.0.0-next.246

Severity

annoyance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant