Skip to content

How to avoid repeating all the @overloads (reportIncompatibleMethodOverride) #9959

Closed Answered by erictraut
ithinuel asked this question in Q&A
Discussion options

You must be logged in to vote

As far as I understand, the @overload should only be required on A and should not need to be replicated on the subclasses.

No, that's a wrong assumption. If a subclass defines an overloaded method (whether or not that method is overriding a method in a parent class), you need to define the overload signatures for the method. You may find that it's useful to read this chapter of the Python typing spec. This section may also be useful because it defines assignability rules for callable types. An overridden method must be assignable to the method it is overriding.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@erictraut
Comment options

Answer selected by ithinuel
@ithinuel
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants