Skip to content

Commit b9fbaf9

Browse files
committed
🐛 Fix typing & imports for python < 3.11
1 parent 8bb363d commit b9fbaf9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/test_annotated.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from enum import StrEnum, auto
1+
from enum import Enum
22

33
import typer
44
from typer.testing import CliRunner
@@ -84,9 +84,9 @@ class TestAnnotatedOptionAcceptsOptionalValue:
8484
def test_enum(self):
8585
app = typer.Typer()
8686

87-
class OptEnum(StrEnum):
88-
val1 = auto()
89-
val2 = auto()
87+
class OptEnum(str, Enum):
88+
val1 = "val1"
89+
val2 = "val2"
9090

9191
@app.command()
9292
def cmd(opt: Annotated[bool | OptEnum, typer.Option()] = OptEnum.val1):

typer/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ def get_click_param(
929929
else:
930930
annotation = str
931931
main_type = annotation
932-
secondary_type: type[bool] | None = None
932+
secondary_type: Union[Type[bool], None] = None
933933
is_list = False
934934
is_tuple = False
935935
parameter_type: Any = None

0 commit comments

Comments
 (0)