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

Allow using sendEvent with a custom event type. #4497

Closed
wants to merge 1 commit into from

Conversation

Half-Shot
Copy link
Contributor

This exposes the ability to send a custom event type outside of TimelineEvents for the purposes of sending events that are not part of the Matrix spec, but may be used for specific applications. This change simply exposes an overload for the existing function, and two tests to ensure the typings are valid.

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • [N/A] Sign-off given on the changes (see CONTRIBUTING.md).

@t3chguy
Copy link
Member

t3chguy commented Nov 5, 2024

The overload makes the strict type moot and open the door to typos, the preferable approach is type declaration merging like EW does. https://github.com/element-hq/element-web/blob/develop/src/%40types/matrix-js-sdk.d.ts#L47-L55

@Half-Shot
Copy link
Contributor Author

Huh, TIL. That should probably be documented in some fashion, since this feels semi-common as a use case.

@Half-Shot Half-Shot closed this Nov 5, 2024
@richvdh
Copy link
Member

richvdh commented Nov 5, 2024

Huh, TIL. That should probably be documented in some fashion, since this feels semi-common as a use case.

PRs to improve the documentation very much welcome 😇

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.

3 participants