mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 00:31:14 +00:00
✨ Feature: 依赖注入支持 Generic TypeVar 和 Matcher 重载 (#2089)
This commit is contained in:
@ -66,7 +66,7 @@ async def handle_onebot(bot: OneBot):
|
||||
:::warning 注意
|
||||
重载机制对所有的参数类型注解都有效,因此,依赖注入也可以使用这个特性来对不同的返回值进行处理。
|
||||
|
||||
但 Bot 和 Event 二者的参数类型注解具有最高检查优先级,如果二者类型注解不匹配,那么其他依赖注入将不会执行(如:`Depends`)。
|
||||
但 Bot、Event 和 Matcher 三者的参数类型注解具有最高检查优先级,如果三者任一类型注解不匹配,那么其他依赖注入将不会执行(如:`Depends`)。
|
||||
:::
|
||||
|
||||
:::tip 提示
|
||||
|
Reference in New Issue
Block a user