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: check_any type error #1021

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion disnake/ext/commands/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
CoroFunc = Callable[..., Coro[Any]]

Check = Union[
Callable[["Cog", "Context[Any]"], MaybeCoro[bool]], Callable[["Context[Any]"], MaybeCoro[bool]]
Callable[["Cog"], Any],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not introduce ambiguity into types by making it so a check can take the cog as the first parameter and now can return anything it wishes to when items in checks should be callables that return a bool?

Copy link
Contributor Author

@KnownBlackHat KnownBlackHat May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i am also trying to type hint in bool but the check inside check_any method is returning a Cog directly.

Callable[["Cog", "Context[Any]"], MaybeCoro[bool]],
Callable[["Context[Any]"], MaybeCoro[bool]],
]
Hook = Union[Callable[["Cog", "Context[Any]"], Coro[Any]], Callable[["Context[Any]"], Coro[Any]]]
Error = Union[
Expand Down