You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that I think about this more, I suspect the neatest solution would be to have a separate validator function that takes unknown, validates it and returns CallMembershipData or throws, then you can construct the CallMembership with a validated CallMembershipData.
Either way, we should do something less confusing, but still actually do explicit validation which we have often neglected in the past.
Have you considered any alternatives?
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
dbkr
added
the
T-Task
Refactoring, enabling or disabling functionality, other engineering tasks
label
Sep 12, 2023
Your use case
https://github.com/matrix-org/matrix-js-sdk/blob/fc2671d8538a3339ca5925ef42e3ba6102f7e8f2/src/matrixrtc/CallMembership.ts#L40 takes a typed data structure and does further validation on it that should be unnecessary because of the types. This is a bit weird and confusing, but is because we are casting the raw content from the event into a CallMembershipData and then having the constructor take a typed interface, so we are technically lying about the type of the data between those points.
Now that I think about this more, I suspect the neatest solution would be to have a separate validator function that takes
unknown
, validates it and returnsCallMembershipData
or throws, then you can construct the CallMembership with a validated CallMembershipData.Either way, we should do something less confusing, but still actually do explicit validation which we have often neglected in the past.
Have you considered any alternatives?
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: