-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate script removes JSDoc comments when there are default values #15530
Comments
Technically speaking the <script>
/**
* @typedef {Object} Props
* @property {number} [default_value] - [default_value=1]
* @property {number} [comment_default_value] - [comment_default_value=1] - This has a comment and an optional value.
*/
/** @type {Props} */
let { default_value = 1, comment_default_value = 1 } = $props();
</script> I guess there's no harm in fixing it if people use this still of comment for |
Personally, I wouldn't mind not having the duplicated default value declaration, but I guess it's helpful to have it in the JSDoc declaration for API docs and editor hints. On https://jsdoc.app/tags-type the definition with an equal sign is included:
|
But that's for |
True, but it's used as component property/parameter, so that's probably why it's used that way. I don't know if the usage is common. |
Describe the bug
When running
npx sv migrate svelte-5
JSDoc comments of the following form in a Svelte 4 appget converted to the following, the comments and default value are not included after the conversion.
From running
npx vitest packages/svelte/tests/migrate -t="jsdoc-with-comments"
and looking around in the migrate script it seems that cleaned_comment is empty here which I think it shouldn't?svelte/packages/svelte/src/compiler/migrate/index.js
Line 1640 in 74917ae
Happy to help fix this but would need some further pointers how.
I tried updating Layer Cake components to Svelte 5 syntax.
Reproduction
I have failing test cases here: rgieseke@634ccc6
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: