mypy:无类型装饰器使 FastAPI 路由的“main”函数无类型

gal*_*h92 5 python mypy fastapi

考虑以下:

@app.post("/")
def main(body: RequestBody) -> dict[str, object]:
    pass
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

无类型装饰器使函数“main”无类型 [misc]mypy(error)

在网上找不到任何有关它的信息。我缺少什么?谢谢

小智 0

Python \xe2\x80\xba Analysis: Type Checking Mode设置从更改strictstandard为我解决了这个问题。

\n