Skip to content

Cannot use the <...> notation to typecast when using lang="ts" #477

@dummdidumm

Description

@dummdidumm

Describe the bug
One cannot use the <...> notation to typecast when using lang="ts". Because we transform the code to TSX, we get a "JSX element '...' has no corresponding closing tag." error.

To Reproduce

<script lang="ts">
    const blubb = <any>null;
</script>

Expected behavior
We should modify the code in a way that this works (maybe using MagicString.move to transform it to as syntax).

System (please complete the following information):

  • OS: Windows
  • IDE: VSCode
  • Plugin/Package: Svelte for VSCode", svelte2tsx

Additional context
Noone brought this up yet so it does not seem that much of an issue.

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