Skip to content
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

(fix) bubble events #433

Merged
merged 2 commits into from
Aug 8, 2020
Merged

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Aug 7, 2020

Added new property $$events_def to bubble events
Also removed some obsolete types

Now correctly infers the bubbled event type and falls back to any if it cannot be inferred.

@jasonlyu123 while removing the obsolete types I noticed that you typed the event record as type SvelteEventRecord = Record<string, Event | Event[]>. Is there a reason why you typed this as "event or array of events"?

Added new property $$events_def to bubble events
Also removed some obsolete types
@jasonlyu123
Copy link
Member

That's for if there are multiple sources of the event. Paving the path for the union type of component event bubble. For now, it should all be the same type.

@dummdidumm
Copy link
Member Author

I don't quite get the idea yet. Could you post a small code sample?

@jasonlyu123
Copy link
Member

jasonlyu123 commented Aug 7, 2020

<Child1 on:whatever />
<Child2 on:whatever />

if somehow these event has a different type

@dummdidumm
Copy link
Member Author

Oooh okay, I get it now.
I think the current solution has the possibility to be enhanced to support something like this, so I would leave it as it is now - or do you have a different opinion?

@dummdidumm dummdidumm merged commit 5fe799c into sveltejs:master Aug 8, 2020
@dummdidumm dummdidumm deleted the fix-events-bubble branch August 8, 2020 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants