Skip to content

sv migrate svelte-5 uses Typescript syntax in bare <script> tags #14219

@twm

Description

@twm

Describe the bug

I ran npx sv migrate svelte-5 and found that it injected Typescript syntax (interface) into bare <script> tags, resulting in errors like this:

.../halo/src/routes/+layout.svelte:8:23
Error: Type annotations can only be used in TypeScript files. (js)

    let { children }: Props = $props()
</script>

I was able to resolve this by adding lang="ts" to the <script> tags.

Reproduction

Run npx sv migrate svelte-5 on twm/halo@e26f3e6

When I did so I got [email protected]

Logs

No response

System Info

I ran this command but the output was garbage — it thought there was a container (nope!) and failed to identify the installed browsers correctly. I'm on Ubuntu 24.04 x86-64.

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions