Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/pydom/component.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
from abc import abstractmethod, ABC
from typing import Tuple
from typing import overload, Iterable, Tuple

from .types.rendering import RenderResult, ChildType


class Component(ABC):
children: Tuple["ChildType", ...]

def __init__(self, *children: "ChildType") -> None:
self.children = children
@overload
def __init__(self, *children: "ChildType") -> None: ...
@overload
def __init__(self, *, children: Iterable["ChildType"]) -> None: ...

def __init__(self, *args, children=None) -> None:
self.children = tuple(children) if children is not None else args

@abstractmethod
def render(self, *_, **kwargs) -> "RenderResult": ...
Expand Down
Loading