Skip to content

Svelte innerHTML is not supported in typescript #494

@cortopy

Description

@cortopy

Describe the bug

The following code from the svelte docs:

<div contenteditable="true" bind:innerHTML={html}></div>

generates the following error:

(JSX attribute) innerHTML: string | undefined
Type '{ contenteditable: "true"; innerHTML: string | undefined; }' is not assignable to type 'HTMLProps<HTMLDivElement>'.
  Property 'innerHTML' does not exist on type 'HTMLProps<HTMLDivElement>'.ts(2322)

To Reproduce

I'm using code similar to this

<script>
const html = "<p>hello</p>"
</script>

<div contenteditable="true" bind:innerHTML={html}></div>

Expected behavior
The tools recognise the HTML code as valid

Screenshots
Screenshot_2020-08-27_23-46-19

System (please complete the following information):

  • OS: Linux
  • IDE: VSCode
  • Plugin/Package:

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