Repository: imryche/blockkit

Issue:
RichText type error for Message
Getting a type error when trying to add `RichText` block to `Message`. 

```
Argument of type "list[Section | RichText]" cannot be assigned to parameter "blocks" of type "List[Block] | None" in function "__init__"
  Type "RichText" cannot be assigned to type "Block"
    "RichText" is incompatible with "Actions"
    "RichText" is incompatible with "Context"
    "RichText" is incompatible with "Divider"
    "RichText" is incompatible with "Header"
    "RichText" is incompatible with "ImageBlock"
    "RichText" is incompatible with "Input"
    "RichText" is incompatible with "Section"Pylance[reportGeneralTypeIssues](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportGeneralTypeIssues)
```

Discussion:

Solution patch:
diff --git a/blockkit/surfaces.py b/blockkit/surfaces.py
index bd64f48..17a90df 100644
--- a/blockkit/surfaces.py
+++ b/blockkit/surfaces.py
@@ -9,6 +9,7 @@ from blockkit.blocks import (
     Header,
     ImageBlock,
     Input,
+    RichText,
     Section,
 )
 from blockkit.components import Component
@@ -17,7 +18,7 @@ from blockkit.validators import validate_text_length, validator
 
 __all__ = ["Home", "Message", "Modal", "WorkflowStep"]
 
-Block = Union[Actions, Context, Divider, Header, ImageBlock, Input, Section]
+Block = Union[Actions, Context, Divider, Header, ImageBlock, Input, RichText, Section]
 
 
 class View(Component):


Test patch:
diff --git a/tests/test_surfaces.py b/tests/test_surfaces.py
index 5e1b9cc..dd08b04 100644
--- a/tests/test_surfaces.py
+++ b/tests/test_surfaces.py
@@ -1,7 +1,7 @@
 import pytest
-from blockkit.blocks import Input, Section
+from blockkit.blocks import Input, RichText, RichTextSection, Section
 from blockkit.elements import Button, PlainTextInput
-from blockkit.objects import MarkdownText, PlainText
+from blockkit.objects import MarkdownText, PlainText, Text
 from blockkit.surfaces import Home, Message, Modal, WorkflowStep
 from pydantic import ValidationError
 
@@ -199,7 +199,10 @@ def test_builds_message():
             Section(
                 text=MarkdownText(text="*markdown* text"),
                 accessory=Button(text=PlainText(text="button"), action_id="action_id"),
-            )
+            ),
+            RichText(
+                elements=[RichTextSection(elements=[Text(text="test_rich_text")])]
+            ),
         ],
     ).build() == {
         "text": "message text",
@@ -212,7 +215,16 @@ def test_builds_message():
                     "text": {"type": "plain_text", "text": "button"},
                     "action_id": "action_id",
                 },
-            }
+            },
+            {
+                "type": "rich_text",
+                "elements": [
+                    {
+                        "type": "rich_text_section",
+                        "elements": [{"type": "text", "text": "test_rich_text"}],
+                    }
+                ],
+            },
         ],
     }