diff --git a/construct_typed/tunion.py b/construct_typed/tunion.py index b575943..4651563 100644 --- a/construct_typed/tunion.py +++ b/construct_typed/tunion.py @@ -11,7 +11,7 @@ DataclassType = t.TypeVar("DataclassType") def TUnionField( - subcon: Construct[ParsedType, BuildTypes], + subcon: Construct[ParsedType, t.Any], doc: t.Optional[str] = None, parsed: t.Optional[t.Callable[[t.Any, "cs.Context"], None]] = None, ) -> ParsedType: @@ -28,9 +28,9 @@ def TUnionField( # some subcons have a predefined default value. all other have "None" default: t.Any = None if isinstance(subcon, (cs.Const, cs.Default)): - if callable(subcon.value): # type: ignore + if callable(subcon.value): raise ValueError("lamda as default is not supported") - default = subcon.value # type: ignore + default = subcon.value # if subcon builds from "None", set default to "None" field = dataclasses.field(