Skip to content

fix type hint annoyance #908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions docs/source/about/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ more info, see the :ref:`Contributor Guide <Creating a Changelog Entry>`.
Unreleased
----------

**Fixed**

- :pull:`908` - minor type hint issue with ``VdomDictConstructor``

**Removed**

- :pull:`907` - accidental import of idom.testing
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ line_length = 88
lines_after_imports = 2

[tool.mypy]
incremental = false
ignore_missing_imports = true
warn_unused_configs = true
warn_redundant_casts = true
Expand Down
18 changes: 18 additions & 0 deletions src/idom/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Type,
TypeVar,
Union,
overload,
)

from typing_extensions import Literal, Protocol, TypeAlias, TypedDict, runtime_checkable
Expand Down Expand Up @@ -199,6 +200,23 @@ class EventHandlerType(Protocol):
class VdomDictConstructor(Protocol):
"""Standard function for constructing a :class:`VdomDict`"""

@overload
def __call__(
self,
*children: VdomChild | VdomChildren,
key: Key | None = None,
**attributes: Any,
) -> VdomDict:
...

@overload
def __call__(
self,
*children: VdomChild | VdomChildren,
**attributes: Any,
) -> VdomDict:
...

def __call__(
self,
*children: VdomChild | VdomChildren,
Expand Down