Skip to content

Attribute draggable is not boolean  #481

@brunnerh

Description

@brunnerh

Describe the bug
draggable has three states, "true", "false" and auto (missing value). Currently that is flagged as an error when TypeScript checking/preprocessing is active.

(JSX attribute) svelte.JSX.HTMLAttributes<HTMLDivElement>.draggable?: boolean
Type 'string' is not assignable to type 'boolean'.ts(2322)

This might just require a type change in svelte-jsx.d.ts to something like the type of contenteditable ("true" | "false" | boolean).

To Reproduce

Example component:

<script type="text/typescript">
</script>

<div draggable="true"/>

Expected behavior
Values "true" and "false" are accepted.

System (please complete the following information):

  • OS: Windows 10, 64bit
  • IDE: VSCode
  • Plugin/Package: Svelte for VSCode

Workaround

Interpolate boolean:

<div draggable={true}/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions