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

How to deal with Command.description() with want_event is True? #7

Open
jfcherng opened this issue Mar 1, 2022 · 1 comment
Open
Labels
question Further information is requested

Comments

@jfcherng
Copy link
Member

jfcherng commented Mar 1, 2022

With want_event=True, we have something like

    def description(self, event: EventDict) -> str: ...

which violates the current stubs

    def description(self) -> str: ...

But if we use @overload like the following in our stubs

    @overload
    def description(self) -> str: ...
    @overload
    def description(self, event: EventDict) -> str: ...

then it will force users to use the following signature in their implementation

    def description(self, event: Optional[EventDict]=None) -> str:

which is annoying and breaks BC.


How do we fix this without using # type: ignore?

@jfcherng jfcherng added the question Further information is requested label Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants