Skip to content

Commit

Permalink
Ignore unnamed slots in svelte adapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardocavazza committed Feb 15, 2024
1 parent 97516f5 commit 48aa012
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-papayas-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chialab/plasma": patch
---

Ignore unnamed slots in svelte adapter.
8 changes: 6 additions & 2 deletions src/svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ export function generateSvelteComponent(entry: Entry, options: SvelteTransformOp
const slots = [];
if (declaration.slots) {
for (const slot of declaration.slots) {
slots.push(`<slot name="${slot.name}" />`);
if (slot.name) {
slots.push(`<slot name="${slot.name}" />`);
}
}
}
slots.push('<slot />');
Expand Down Expand Up @@ -280,7 +282,9 @@ import { ${getAttributes(definition.extend ?? definition.name).split('<')[0]} }
const slotsTypings = [];
if (declaration.slots) {
for (const slot of declaration.slots) {
slotsTypings.push(`'${slot.name}': {};`);
if (slot.name) {
slotsTypings.push(`'${slot.name}': {};`);
}
}
}

Expand Down

0 comments on commit 48aa012

Please sign in to comment.