-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
- Python version: 3.11 (could also be reproduced with 3.12 and 3.10)
- minicli version: 0.5.3
Hi, thanks for the useful lib. We recently ran into an unexpected behaviour when hint typing the CLI functions.
Minimal reproduction:
from minicli import cli, run
@cli
async def age(my_age: int = None) -> None:
if my_age:
print(type(my_age))
@cli
async def age_optional(my_age: int | None = None) -> None:
if my_age:
print(type(my_age))
if __name__ == "__main__":
run()
When running the commands:
- First command (
age
) returnsint
- Second command (
age_optional
) incorrectly returnsstr
Note: same behaviour with Optional[int]
and Union[int, None]
.
Is this expected?
Metadata
Metadata
Assignees
Labels
No labels