nonebot-plugin-send-anything-anywhere icon indicating copy to clipboard operation
nonebot-plugin-send-anything-anywhere copied to clipboard

AllSupportedPlatformTarget的判断问题

Open AzideCupric opened this issue 1 year ago • 0 comments

目前 AllSupportedPlatformTarget 是一个泛型 https://github.com/MountainDash/nonebot-plugin-send-anything-anywhere/blob/cdd96b4b498bab6995151315f183bb3f81ddf8d1/nonebot_plugin_saa/registries/platform_send_target.py#L265-L279 无法做到判断 Platfrom.deserialize 结果为 AllSupportedPlatformTarget, 例如: https://github.com/MountainDash/nonebot-bison/blob/2fc6e253f3488cd6aa7a1f7b5e76b37297be2d04/nonebot_bison/config/subs_io/nbesf_model/v2.py#L36-L41 https://github.com/MountainDash/nonebot-bison/blob/2fc6e253f3488cd6aa7a1f7b5e76b37297be2d04/nonebot_bison/config/subs_io/subs_io.py#L43-L49 能否提供一个

def is_supported_platform_target(target: PlatformTarget) -> TypeGuard[AllSupportedPlatformTarget]:
	...

工具来做到这件事

AzideCupric avatar Feb 22 '24 09:02 AzideCupric