svelte icon indicating copy to clipboard operation
svelte copied to clipboard

Svelte 5: Typescript error on custom radio due to bind:group not being bindable

Open GeoffCox opened this issue 4 months ago • 9 comments

Describe the bug

When writing a custom radio input component that passes ...rest to the rendered input element, callers get a typescript error for bind:group not being bindable. This makes it impossible to create a custom radio component without re-implementing all of group behavior.

HTMLInputAttributes in svelte/elements lists 'bind:group'.

Attempted workaround #1: Added group as a local $props() variable in CustomRadio, and binding to the input element, but group is not a property on HTMLInputAttributes.

Attempted workaround #2: Added "bind:group": group as a local $props() variable in CustomRadio, but the caller error still exists.

Attempted workaround #3: Added "bind:group": group = $bindable(undefined) as a local $props() variable in CustomRadio, but the caller error still exists.

Reproduction

REPL repro

Logs

No response

System Info

Svelte 5 REPL as of 2024-10-04

Severity

blocking an upgrade

GeoffCox avatar Oct 04 '24 15:10 GeoffCox