Skip to content

Commit 746e567

Browse files
committed
Fix type warning from ty
error[invalid-argument-type]: Argument to function `render_blocks` is incorrect --> tests/integration_test.py:56:30 | 56 | blocks=render_blocks(blocks), | ^^^^^^ Expected `list[Block]`, found `list[Header | Divider | MarkdownSection | MarkdownSectionFields | CodeBlock]` | info: Function defined here --> ca_slack_block_kit/__init__.py:38:5 | 38 | def render_blocks(blocks: list["Block"]) -> list[dict]: | ^^^^^^^^^^^^^ --------------------- Parameter declared here | info: `list` is invariant in its type parameter info: Consider using the covariant supertype `collections.abc.Sequence` info: For more information, see https://docs.astral.sh/ty/reference/typing-faq/#invariant-generics
1 parent 68b2deb commit 746e567

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ca_slack_block_kit/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from abc import ABC, abstractmethod
1212
from dataclasses import dataclass
13+
from typing import Sequence
1314

1415

1516
@dataclass(frozen=True)
@@ -35,7 +36,7 @@ class Emoji:
3536
SPARKLES = ":sparkles:"
3637

3738

38-
def render_blocks(blocks: list["Block"]) -> list[dict]:
39+
def render_blocks(blocks: Sequence["Block"]) -> list[dict]:
3940
"""Render a list of Block objects into a list of dictionaries compatible with the Slack SDK client chat_postMessage function.
4041
4142
Args:

0 commit comments

Comments
 (0)