previously the typing of function twitchio.ext.command.core.command declared an argument cls: C = Command, but that was throwing a linting error (vscode pylance in my case) in any code that tried to create a command. it has been changed to cls: type[C] = Command.
demo code that showed the error before, and fixed after the change:
from twitchio.ext import commands
class MyBot(commands.Bot):
# Argument of type "type[Command]" cannot be assigned to parameter "cls" of type "C@command" in function "command"
# Type "type[Command]" cannot be assigned to type "Command"
# "type[type]" is incompatible with "type[Command]"PylancereportGeneralTypeIssues
@commands.command(name="hello", aliases=['hi'])
async def hello(self, ctx: commands.Context):
await ctx.send(f'Hello {ctx.author.name}!')
Checklist
[x] If code changes were made then they have been tested.
[ ] I have updated the documentation to reflect the changes.
[ ] I have updated the changelog with a quick recap of my changes.
[x] This PR fixes an issue.
[ ] This PR adds something new (e.g. new method or parameters).
[ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
[ ] This PR is not a code change (e.g. documentation, README, ...)
Pull request summary
previously the typing of function
twitchio.ext.command.core.command
declared an argumentcls: C = Command
, but that was throwing a linting error (vscode pylance in my case) in any code that tried to create a command. it has been changed tocls: type[C] = Command
.demo code that showed the error before, and fixed after the change:
Checklist