- 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) returns int
- Second command (
age_optional) incorrectly returns str
Note: same behaviour with Optional[int] and Union[int, None].
Is this expected?
Hi, thanks for the useful lib. We recently ran into an unexpected behaviour when hint typing the CLI functions.
Minimal reproduction:
When running the commands:
age) returnsintage_optional) incorrectly returnsstrNote: same behaviour with
Optional[int]andUnion[int, None].Is this expected?