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

Typing Bug #1055

Open
3 tasks done
TrapDrap opened this issue May 10, 2023 · 1 comment
Open
3 tasks done

Typing Bug #1055

TrapDrap opened this issue May 10, 2023 · 1 comment
Labels
help wanted Anyone is free to help, the issue shouldn't be *too* hard. p: low Priority: low - not important to be worked on t: typing Type: typing - the types doesn't seem quite right

Comments

@TrapDrap
Copy link
Contributor

TrapDrap commented May 10, 2023

Summary

command Groups created under another command Group typing is incorrect

Reproduction Steps

This change is after ooliver's fix for the previous typing correction, which has not been pushed to main lib yet
https://discord.com/channels/881118111967883295/1087201133421936650

  1. Create a cog.
  2. Create a command group inside the cog.
  3. Create a command group under the group created above.
  4. Step above should create a highlighted red typing error but the command works fine.

Minimal Reproducible Code

@commands.group()
async def something(self, ctx, arg):
    ...

@something.group()
async def subgroup(self, ctx, arg):
    ...

Expected Results

Both should be typed correctly, and would not produce a red highlighted error.

Actual Results

@something.group() is highlighted.
image

(note the name of the Cog is config)

Argument of type "(self: Self@config, ctx: Unknown, arg: Unknown) -> Coroutine[Any, Any, None]" cannot be assigned to parameter of type "(Context[Unknown], **P@group) -> Coro[Any]"
  Type "(self: Self@config, ctx: Unknown, arg: Unknown) -> Coroutine[Any, Any, None]" cannot be assigned to type "(Context[Unknown], **P@group) -> Coro[Any]"
    Parameter 1: type "Context[Unknown]" cannot be assigned to type "Self@config"
      "Context[Unknown]" is incompatible with "config"

Intents

N/A

System Information

v2.5.0a with ooliver's corrected typing for @commands.command(), @commands.group() and @bot.command()

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

The error is located at nextcord/ext/commands/core.py under line 1394
I wasn't able to figure out how to fix it though.

@TrapDrap TrapDrap added the t: unconfirmed bug Type: bug - needs testing on if this is an issue label May 10, 2023
@EmreTech
Copy link
Collaborator

This issue still persists on the currently latest commit. I did find a temporary solution, which involves setting the cls parameter to commands.Group.

@EmreTech EmreTech added p: low Priority: low - not important to be worked on t: typing Type: typing - the types doesn't seem quite right help wanted Anyone is free to help, the issue shouldn't be *too* hard. and removed t: unconfirmed bug Type: bug - needs testing on if this is an issue labels Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Anyone is free to help, the issue shouldn't be *too* hard. p: low Priority: low - not important to be worked on t: typing Type: typing - the types doesn't seem quite right
Projects
None yet
Development

No branches or pull requests

2 participants