Skip to content

Commit 02ee116

Browse files
authored
(fix) Insert comma between bubbled events and custom events (#887)
#886
1 parent 85e35e4 commit 02ee116

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/svelte2tsx/src/svelte2tsx/nodes/ComponentEvents.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,13 @@ class ComponentEventsFromEventsMap {
204204
if (this.eventDispatcherTyping) {
205205
return `__sveltets_toEventTypings<${this.eventDispatcherTyping}>()`;
206206
}
207+
207208
return (
208209
'{' +
209-
this.eventHandler.bubbledEventsMapToString() +
210-
[...this.dispatchedEvents.keys()]
211-
.map((e) => `'${e}': __sveltets_customEvent`)
212-
.join(', ') +
210+
[
211+
...this.eventHandler.bubbledEventsAsStrings(),
212+
...[...this.dispatchedEvents.keys()].map((e) => `'${e}': __sveltets_customEvent`)
213+
].join(', ') +
213214
'}'
214215
);
215216
}

packages/svelte2tsx/src/svelte2tsx/nodes/event-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export class EventHandler {
4646
return eventNames;
4747
}
4848

49-
bubbledEventsMapToString() {
50-
return Array.from(this.bubbledEvents.entries()).map(eventMapEntryToString).join(', ');
49+
bubbledEventsAsStrings() {
50+
return Array.from(this.bubbledEvents.entries()).map(eventMapEntryToString);
5151
}
5252

5353
private handleEventHandlerBubble(parent: Node, eventName: string): void {

0 commit comments

Comments
 (0)