fix optional wrapping of static call methods in pyi

This commit is contained in:
Khaleel Al-Adhami 2025-01-31 19:48:29 -08:00
parent 68547dce4c
commit 42a2a6f640
4 changed files with 4 additions and 3 deletions

View File

@ -151,7 +151,7 @@ def default_backend_exception_handler(exception: Exception) -> EventSpec:
position="top-center",
id="backend_error",
style={"width": "500px"},
) # pyright: ignore [reportReturnType]
)
else:
error_message.insert(0, "An error occurred.")
return window_alert("\n".join(error_message))

View File

@ -177,7 +177,7 @@ class ToastNamespace(ComponentNamespace):
@staticmethod
def __call__(
message: Union[str, Var] = "", level: Optional[str] = None, **props
) -> "Optional[EventSpec]":
) -> "EventSpec":
"""Send a toast message.
Args:

View File

@ -699,6 +699,7 @@ def _generate_staticmethod_call_functiondef(
value=_get_type_hint(
typing.get_type_hints(clz.__call__).get("return", None),
type_hint_globals,
is_optional=False,
)
),
)

View File

@ -1623,7 +1623,7 @@ async def test_state_with_invalid_yield(capsys, mock_app):
id="backend_error",
position="top-center",
style={"width": "500px"},
) # pyright: ignore [reportCallIssue, reportArgumentType]
)
],
token="",
)