Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Fix type annotation of typer.run() #284

Merged
merged 2 commits into from
Nov 5, 2022

Conversation

yassu
Copy link
Contributor

@yassu yassu commented May 23, 2021

Problem: type annotation of typer.run is

def run(function: Callable[..., Any]) -> Any

However, this function returns None.

Solution: type annotation of typer.run changes to

def run(function: Callable[..., Any]) -> None

@yassu yassu changed the title Fix type annotation for typer.run Fix type annotation of typer.run May 23, 2021
@svlandeg svlandeg added bug Something isn't working types Type hints and type checking labels Apr 21, 2022
@alexreg
Copy link

alexreg commented May 10, 2022

Alternatively, the last line of the function could be return app() instead of app(), but this probably isn't necessary.

@tiangolo tiangolo changed the title Fix type annotation of typer.run 🎨 Fix type annotation of typer.run() Nov 5, 2022
@github-actions
Copy link

github-actions bot commented Nov 5, 2022

📝 Docs preview for commit 097a89f at: https://6366755339a2407903ea73ce--typertiangolo.netlify.app

@tiangolo
Copy link
Member

tiangolo commented Nov 5, 2022

Good catch, thanks @yassu! 🚀

@tiangolo tiangolo enabled auto-merge (squash) November 5, 2022 14:40
@tiangolo tiangolo merged commit 249b689 into fastapi:master Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working types Type hints and type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants