Skip to content

Commit 5f5562f

Browse files
mypy typing updates (#9)
1 parent 09eb44c commit 5f5562f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/py/reactpy/reactpy/core/component.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22

33
import inspect
44
from functools import wraps
5-
from typing import Any, Callable, ParamSpec, TypeVar
5+
from typing import Any, Callable, ParamSpec, TypeVar, overload
66

77
from reactpy.core.types import ComponentType, VdomDict
88

99
T = TypeVar("T", bound=ComponentType | VdomDict | str | None)
1010
P = ParamSpec("P")
1111

1212

13+
@overload
14+
def component(function: None = None, *, priority: int) -> Callable[P, Component]: ...
15+
16+
1317
def component(
1418
function: Callable[P, T] | None = None,
1519
*,

src/py/reactpy/reactpy/core/hooks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ class ReconnectingOnly(list):
5454

5555

5656
@overload
57-
def use_state(initial_value: Callable[[], _Type]) -> State[_Type]: ...
57+
def use_state(initial_value: Callable[[], _Type], *, server_only: bool = False) -> State[_Type]: ...
5858

5959

6060
@overload
61-
def use_state(initial_value: _Type) -> State[_Type]: ...
61+
def use_state(initial_value: _Type, *, server_only: bool = False) -> State[_Type]: ...
6262

6363

6464
def use_state(
@@ -509,7 +509,7 @@ def empty(self) -> bool:
509509
return False
510510

511511

512-
def use_ref(initial_value: _Type, server_only: bool = True) -> Ref[_Type]:
512+
def use_ref(initial_value: _Type, *, server_only: bool = True) -> Ref[_Type]:
513513
"""See the full :ref:`Use State` docs for details
514514
515515
Parameters:

0 commit comments

Comments
 (0)