prefer-typed-cli
Declare CLI arguments with typed Typer commands.
Why
A list of argv strings does not declare positional meaning, conversions or option validation. Typer derives those contracts from the command signature and rejects invalid arguments before calling application code.
Fix
Use typer.run on a command with explicit parameter types, or register typed functions with Typer.command/callback. Preserve option names, defaults, validation and exit behavior during migration.
Examples
import typer
def main(service): deploy(service)
typer.run(main)import typer
def main(service: str, attempts: int = 3) -> None: deploy(service, attempts)
if __name__ == "__main__": typer.run(main)import sys
def main(arguments: list[str]) -> None: deploy(arguments[0])
main(sys.argv[1:])import typer
def main(service: str, attempts: int = 3) -> None: deploy(service, attempts)
if __name__ == "__main__": typer.run(main)