Skip to content

Svelte 5 migration: Comments for props #13747

@sdarnell

Description

@sdarnell

Describe the bug

When migrating with npx sv migrate svelte-5 using sv@0.5.7 comments for props are copied across to the type definition, but lose the comment status.

<script lang="ts">
	/** Minimum width of each element in the grid */
	export let size = '13rem';
	/** Gap between elements */
	export let gap = '1rem';

	let _class = '';
	// noinspection ReservedWordAsName
	export { _class as class };
</script>

Hi there

Gets migrated to:

<script lang="ts">
	
	

	interface Props {
		Minimum width of each element in the grid
		size?: string;
		Gap between elements
		gap?: string;
		class?: string;
	}

	let { size = '13rem', gap = '1rem', class: _class = '' }: Props = $props();
	// noinspection ReservedWordAsName
	
</script>

Hi there

I ran the sv migrate locally but also pasted the above into the Svelte 5 playground and pressed 'Migrate'.

The key issue is the comments 'Minimum width of each element in the grid' loses the /** */

Minor issues:

There's a few blank lines left behind.

The WebStorm/Rider noinspection comment is incorrectly placed, but that's a tricky one and I'm more than happy to live with that.

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE2WQwUrEQAyGXyXMZaEsFPHW3RX25F704MWDIzK2aRuYyQyTdFctfXcZ14LgLfnD98Gf2fTkUUzzMht2AU1jjimZrdHPVBY5o1c0WyNxym1J9tJmSgre8XCwRsWaO8tW66qCB2IKU4ALdTpC7AFdOwJ6DMgKxKAjwpCpg6ouDH6kmBU8Kgh9IRxgc3ObMWx2q_HeJXhHvSDy6pH_8ODSD7uibLXEb613IuXyK6yBI7EkbJUiwxMK5jN2zzF3R3l0Af945xV3Atdh2Vne19f6pTKfqBTK5T0hdtQTdqbRPOHyunwD6XinBVkBAAA=

gets migrated to

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE11QTUvDQBD9K8MiVKEQxFtsLT3pRREvHozImp0kA9nZZWfaoiH_XTZbD3oYZt6b7zeZjkYUU79Nhq1HU5t9jGZt9CtmIEccFc3aSDikNjMbaRNFhdFyv22MSmPuGm70bNwosWLqbIvwnEIUmJaUPhKTP3g4kdMBQgdo2wFwRI-sQAw6IPSJXCkX-sZdDaKJuL8t3L2N8Il6QuTfRimZ3sb_xe1oRf6SczlwRIUJ8gLYwur6JqFfraG3cYEFLd01fCw-8yuY6_NDW7iIObi8WqZWFXAgloitUmB4QcF0RPcaktvLk_VYtNlURbosFz9Q_jdlaX1w1BE6U2s64Pw-_wC2ja1TlQEAAA==

Logs

No response

System Info

System:
    OS: macOS 15.0.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 87.39 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 9.12.1 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 129.0.6668.101
    Safari: 18.0.1

Severity

annoyance

PS Raised here (rather on sv repo) as migration tool says:

This migration is experimental — please report any bugs to https://github.com/sveltejs/svelte/issues

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