You will receive the values as you declared them, as a list of str.
Check it:
fast βπ¬ The default value is 'None'python main.py No provided users (raw input = None) Aborted!
π¬ Now pass a userpython main.py --user Camila Processing user: Camila
π¬ And now try with several userspython main.py --user Camila --user Rick --user Morty Processing user: Camila Processing user: Rick Processing user: Morty
The same way, you can use other types and they will be converted by Typer to their declared type:
fromtypingimportListimporttyperfromtyping_extensionsimportAnnotateddefmain(number:Annotated[List[float],typer.Option()]=[]):print(f"The sum is {sum(number)}")if__name__=="__main__":typer.run(main)
π€ Other versions and variants
Tip
Prefer to use the Annotated version if possible.
fromtypingimportListimporttyperdefmain(number:List[float]=typer.Option([])):print(f"The sum is {sum(number)}")if__name__=="__main__":typer.run(main)