lifespan incompatible type #10415
Replies: 1 comment 2 replies
-
Duplicated #10413 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
I'm using a custom async context manager with lifespan. The program runs as expected but mypy returns this error:
mypy:
866: error: Argument "lifespan" to "FastAPI" has incompatible type "Callable[[FastAPI], AsyncGenerator[dict[str, Dao] | None, None]]"; expected "Callable[[FastAPI], AbstractAsyncContextManager[None]] | Callable[[FastAPI], AbstractAsyncContextManager[Mapping[str, Any]]] | None" [arg-type]
What does this mean?
Operating System
Windows
Operating System Details
No response
FastAPI Version
0.103.2
Pydantic Version
2.4.2
Python Version
Python 3.11.4
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions