-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
Description
Describe the bug
In Svelte 4, you could use bind:this
with a dynamic type..
<script>
let type = 'text';
let el;
</script>
<input {type} bind:this={el} />
but in Svelte 5 (runes or non-runes mode), this throws a compiler error: 'type' attribute must be a static text value if input uses two-way binding
This was explicitly checked and allowed in Svelte 4, so likely a regression.
Reproduction
- Svelte 4 REPL (works)
- Svelte 5 REPL (error)
Logs
index-a870eda6.js:83 CompileError: 'type' attribute must be a static text value if input uses two-way binding
at sr (compiler.cjs@5.0.0-next.15:1:226153)
at BindDirective (compiler.cjs@5.0.0-next.15:1:502150)
at r (compiler.cjs@5.0.0-next.15:1:305770)
at o (compiler.cjs@5.0.0-next.15:1:305833)
at r (compiler.cjs@5.0.0-next.15:1:305770)
at o (compiler.cjs@5.0.0-next.15:1:305833)
at Object.next (compiler.cjs@5.0.0-next.15:1:112832)
at r (compiler.cjs@5.0.0-next.15:1:305753)
at next (compiler.cjs@5.0.0-next.15:1:305809)
at _ (compiler.cjs@5.0.0-next.15:1:305020)
### System Info
```shell
svelte: `5.0.0-next.15`
Severity
blocking an upgrade