-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Closed
Copy link
Description
Describe the bug
I'm using the great "zero-effort type safety" features introduced here: https://svelte.dev/blog/zero-config-type-safety and they work great.
However, running pnpm dlx svelte-migrate svelte-5 introduces a Props interface that disables this feature. Of course, this only applies to routes/**/+*.svelte files.
Svelte 4 code:
<script lang="ts">
export let data
</script>Automatically migrated Svelte 5 code:
<script lang="ts">
interface Props {
data: any;
}
let { data }: Props = $props();
</script>It would be better if the migration would skip these cases, like this:
<script lang="ts">
let { data } = $props();
</script>Reproduction
- Run
pnpm dlx svelte-migrate svelte-5 - migrate files in
src src/routes/+page.sveltenow hasinterface Props { data: any; }:(
Logs
No response
System Info
System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Max
Memory: 12.58 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.0 - ~/.asdf/installs/nodejs/20.18.0/bin/node
npm: 10.8.2 - ~/.asdf/plugins/nodejs/shims/npm
pnpm: 9.12.2 - ~/.asdf/installs/nodejs/20.18.0/bin/pnpm
Browsers:
Chrome: 129.0.6668.101
Edge: 130.0.2849.46
Safari: 17.6
Safari Technology Preview: 18.0
npmPackages:
@sveltejs/kit: ^2.7.1 => 2.7.1
svelte: ^5.0.0 => 5.0.3Severity
annoyance