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

support for 3.12 type aliases #9813

Closed
HEROgold opened this issue May 1, 2024 · 2 comments · Fixed by #9815
Closed

support for 3.12 type aliases #9813

HEROgold opened this issue May 1, 2024 · 2 comments · Fixed by #9815
Labels
feature request This is a feature request.

Comments

@HEROgold
Copy link

HEROgold commented May 1, 2024

Summary

Discord 2.3.2 doesn't support python 3.12 type alises

What is the feature request for?

discord.ext.commands

The Problem

When creating aliases like this
MemberOrRole = Role | Member
The transformer has no issues

When creating aliases with the type statement, the transformer raises the error unsupported type annotation.
type MemberOrRole = Role | Member

The only difference in this example is the statement.

The Ideal Solution

Being able to just use type MemberOrRole = Role | Member
or more complex situations like type NumberOrStringSequence [T: (int, float, str)] = Sequence[T]

The Current Solution

No response

Additional Context

The type statement for type aliases allows for generic type annotation, without the need for the typing module, and this greatly improves the coding experience for those that use 3.12. Just like mentioned on the PEP-695 it allows for declaring types, with constraints. That leads to a more controlled and readable environment.

@HEROgold HEROgold added the feature request This is a feature request. label May 1, 2024
@No767
Copy link

No767 commented May 2, 2024

I really doubt that this is needed. I'll let the rest decide on this

@Rapptz
Copy link
Owner

Rapptz commented May 2, 2024

Should be doable. It's a typing.TypeAliasType so not too bad to add to support to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request This is a feature request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants