Skip to content

Svelte 5: Type assertion with bind syntax no longer causes a crash but ; expected. error is still shown when bind:this is used. #2277

@HighFunctioningSociopathSH

Description

Describe the bug

As of version 44 the bug has been fixed and trying to use type assertion on HTML elements and components no longer causes a crash but when bind:this is used a ; exptected error is shown which is annoying. note that this is only shown for bind:this and if for example bind:something where something is a prop is used then no error is shown. Just thought I should point it out in case anyone missed it.

Reproduction

<svelte:options runes />

<script lang="ts">
  import Component from "$components/Component/Component.svelte";

  let div = $state<HTMLDivElement>();
  let object = $state<unkown>();
</script>

<div bind:this={div as any}></div>
<Component bind:this={object as any}></Component>

Logs

No response

System Info

System:
    OS: Windows 11 10.0.22621
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-12650H
    Memory: 6.00 GB / 15.63 GB
  Binaries:
    Node: 18.14.2 - C:\Program Files\nodejs\node.EXE
    npm: 9.7.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (120.0.2210.144)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    svelte: ^5.0.0-next.44 => 5.0.0-next.44

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions