Open
Description
Following up on earlier work on polls and todo widget handling in messages, this could involve:
- Use TypedDict (or dataclass) for the result of process_todo_widget (and for polls) instead of a nested dict with a union.
- Consider if the extracted JSON should match specific types, that we can define using TypedDict or similar too.
- Consider factory fixtures for the Submessage content in tests.
- Move Submessage into api_types.py, and use it to improve the definition of Message.
See # zulip-terminal > Widget followup work for the original listing of these points and for followup discussion. These points arose in earlier work on widget implementation, so you might read those PRs to understand the background further.