Message event zod types - #30
Conversation
| this.contentElement.innerHTML = "" | ||
| const content = parseEventContent(this.message.getContent()) | ||
| const content = this.content as Audio |
There was a problem hiding this comment.
Is this guaranteed to be of type Audio already/type checked? Can the cast be avoided using some typescript magic?
There was a problem hiding this comment.
It is (in practice) by only calling that constructor with an audio message.
I tried TypeScript magic and failed.
Getting it to work for ClientEvent types was already difficult enough (see m.room.name component)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: cfp <44261356+cfpwastaken@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
j0code
commented
Aug 16, 2026
I found out why some rooms don't open. The click event listener is attached to the wrong element - the text instead of the tab. This is main as well and has nothing to do with this PR. I'll make an issue. |
| Error parsing content of ${this.message.getType()} message: | ||
| \`\`\`json | ||
| ${JSON.stringify(this.message.getContent(), undefined, " ")} | ||
| \`\`\` | ||
| Error: | ||
| \`\`\`text | ||
| ${errorMessage} | ||
| \`\`\` |
There was a problem hiding this comment.
If the message content or error message contain ``` it would mess up the message.
Maybe do the UI for this manually?
Adds zod types to validate/parse Client Events.
Improves typing and maintainability.
Specs used:
Known issues:
if the message fails to parse, there is currently no fallback (e.g. a message showing the error)example: #"agent encryption" - Agent sent two messages with content: {}