Skip to content

Svelte 5: Incorrect Codegen #10276

@abdel-17

Description

@abdel-17

Describe the bug

Svelte 5 generates incorrect code, causing the type of the underlying #value to be incorrect when set() is called.

Screenshot 2024-01-24 at 5 07 28 AM

It's worth noting that simply storing this.#value in a local variable first fixes the issue.

Screenshot 2024-01-24 at 5 12 16 AM

Reproduction

REPL

Logs

No response

System Info

System:
    OS: macOS 14.2.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 3.15 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
Binaries:
    Node: 21.5.0 - /usr/local/bin/node
    npm: 10.2.4 - /usr/local/bin/npm
    pnpm: 8.14.0 - /usr/local/bin/pnpm
Browsers:
    Safari: 17.2.1

Severity

annoyance

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions