Skip to content

bind:checked and remote form functions give warnings #16994

@thebjorn

Description

@thebjorn

Describe the bug

The following checkbox binding

<input {...edit_customer.fields.active.as('checkbox')} bind:checked={customer.active}>

errors with

[plugin:vite-plugin-svelte:compile] src/routes/+page.svelte:25:15 `bind:checked` can only be used with `<input type="checkbox">`
https://svelte.dev/e/bind_invalid_target

if I add type="checkbox":

<input type="checkbox" {...edit_customer.fields.active.as('checkbox')} bind:checked={customer.active}>

I get a warning

'type' is specified more than once, so this usage will be overwritten.js(2783)

Reproduction

https://github.com/thebjorn/checkbox-bug

Logs

Without `type="checkbox"`:

:05:24 PM [vite] (ssr) Error when evaluating SSR module /src/routes/+page.svelte: src/routes/+page.svelte:26:15 `bind:checked` can only be used with `<input type="checkbox">`
https://svelte.dev/e/bind_invalid_target
  Plugin: vite-plugin-svelte:compile
  File: src/routes/+page.svelte:26:15
   24 |      <input
   25 |                 {...edit_customer.fields.active.as('checkbox')}
   26 |                 bind:checked={customer.active}>
                                                      ^
   27 |          Active
   28 |    </label>

[500] GET /

with `type="checkbox"` (vscode):

'type' is specified more than once, so this usage will be overwritten.js(2783)

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
    Memory: 39.98 GB / 63.92 GB
  Binaries:
    Node: 24.10.0 - C:\nvm4w\nodejs\node.EXE
    npm: 10.9.2 - C:\Users\bp.DATAKORTET\AppData\Roaming\npm\npm.CMD
    pnpm: 10.11.0 - C:\Users\bp.DATAKORTET\AppData\Local\Microsoft\WinGet\Links\pnpm.EXE
  Browsers:
    Chrome: 141.0.7390.108
    Edge: Chromium (141.0.3537.85)
    Firefox Developer Edition: 145.0 - C:\Program Files\Firefox Developer Edition\firefox.exe
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    svelte: ^5.41.1 => 5.41.1

Severity

annoyance

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