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

TypeScript EventHandlers do not support all properties in payload #1111

Open
Falke-Design opened this issue Feb 18, 2022 · 0 comments
Open

Comments

@Falke-Design
Copy link
Collaborator

In the event payload there is always the source and the possibility to add custom properties. Is it possible to extend types and make a base event type with source and custom properties?

TS:

export type GlobalRotateModeToggledEventHandler = (e: {
enabled: boolean;
map: L.Map;
}) => void;

JS where the payload and the custom payload are merged:

__fire(fireLayer, type, payload, source, customPayload = {}) {
payload = merge(payload, customPayload, { source });
L.PM.Utils._fireEvent(fireLayer, type, payload);
},

@ryan-morris maybe you have time to check this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant