Skip to content

Migration : Error migrating parametized slots #13472

Closed
@adiguba

Description

@adiguba

Describe the bug

I found some errors when migrating parametized slots.

Constant values ​​are not reported correctly, and produce an error :

-<slot name="header" title="Hello World" />
+{@render header?.({ title: Hello World, })}

REPL : https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAChXLwQqDMBCE4VcJcxa8h1rorW_gofYgzUgDqxuStSDiuzc5_h8zJ5YoLPCvE9u8Eh6PlNDBjtSi_CjG2kX3_GlyK6Lm2naY8OUcmCc4iyYNnhRRN2qWULW_1-eqIS6RAd7yzut9_QEn165-dAAAAA==

Dynamic values ​​are wrapped in an additional object :

<script>
+	/** @type {{header?: import('svelte').Snippet<[any]>}} */
+	let { header } = $props();
	let value = "Hello World";
</script>
-<slot name="header" title={value} />
+{@render header?.({ title: {value}, })}

=> header?.({ title: {value}, })} might be header?.({ title: value, })}

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

Also: is it normal that slots are converted to snippets in the component, but not in the code that uses it?

REPL : https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACn1PywrCMBD8lbCXXkpDrzUWxIt_4MF4KM2WBvIiSQUp_XcThdSDeFpmmMfOCpNUGKC7rWAGjdDByTmoIT5dBuGBKmLCwS5-zAwLo5cu9tzwKLWzPpKzTdegiWTyVpOqoYVpPgHVIcu5YXR3G1ZU7zA2tyQoG48cZhwEeg79BZWy5Gq9EozObZ8Tdld6S1shJ4kCuugX3Oqyoqj-b0l9JDu-Sgn9EXzfXnGfp24qAQAA

Reproduction

See repl above

Logs

No response

System Info

REPL

Severity

annoyance

Metadata

Metadata

Assignees

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