Skip to content

Commit dcd30c2

Browse files
committed
fix mypy
1 parent e39404d commit dcd30c2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/idom/core/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Component:
3939

4040
def __init__(
4141
self,
42-
function: Callable[..., Union[ComponentType, VdomDict]],
42+
function: Callable[..., ComponentType | VdomDict | None],
4343
key: Optional[Any],
4444
args: Tuple[Any, ...],
4545
kwargs: Dict[str, Any],

src/idom/core/layout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
from ._event_proxy import _wrap_in_warning_event_proxies
3434
from .hooks import LifeCycleHook
35-
from .proto import ComponentType, EventHandlerDict, VdomJson
35+
from .proto import ComponentType, EventHandlerDict, VdomDict, VdomJson
3636
from .vdom import validate_vdom_json
3737

3838

@@ -204,7 +204,7 @@ def _render_component(
204204
# wrap the model in a fragment (i.e. tagName="") to ensure components have
205205
# a separate node in the model state tree. This could be removed if this
206206
# components are given a node in the tree some other way
207-
wrapper_model = {"tagName": ""}
207+
wrapper_model: VdomDict = {"tagName": ""}
208208
if raw_model is not None:
209209
wrapper_model["children"] = [raw_model]
210210

src/idom/core/proto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class _VdomDictOptional(TypedDict, total=False):
8787
children: Sequence[
8888
# recursive types are not allowed yet:
8989
# https://github.com/python/mypy/issues/731
90-
Union[ComponentType, Dict[str, Any], str]
90+
Union[ComponentType, Dict[str, Any], str, Any]
9191
]
9292
attributes: VdomAttributes
9393
eventHandlers: EventHandlerDict # noqa

src/idom/html.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@
166166

167167
def _(*children: Any) -> VdomDict:
168168
"""An HTML fragment - this element will not appear in the DOM"""
169-
attributes, children = coalesce_attributes_and_children(children)
169+
attributes, coalesced_children = coalesce_attributes_and_children(children)
170170
if attributes:
171171
raise TypeError("Fragments cannot have attributes")
172-
return {"tagName": "", "children": children}
172+
return {"tagName": "", "children": coalesced_children}
173173

174174

175175
# Dcument metadata

0 commit comments

Comments
 (0)