Closed TilmanK closed 3 years ago
Seems reasonable to me :+1:
https://github.com/python-qt-tools/PyQt5-stubs/commit/fba0ed6a00bb1f43b94bcffb06682eef0d85b53f https://github.com/python-qt-tools/PyQt5-stubs/blob/2a97b494ce7b5a7bed0087c27b89758399e6a7ae/PyQt5-stubs/QtCore.pyi#L58
The callable's return type is presently set to object
. This should accept any type. Unlike Any
, this doesn't allow code to presume any attribute exists on the returned object.
(sorry we haven't gotten a release out, maybe 'soon'...)
Yeah, I really hope to see a release soon. Can't wait to remove a lot of # type: ignore ;),
Mypy complains when connecting any signal to a slot, that would actually return something other than None/void.
A good example is QWidget.close() which returns a bool. When connecting a signal to this slot, mypy complains:
Argument 1 to "connect" of "pyqtSignal" has incompatible type "Callable[[], bool]"; expected "Union[Callable[..., None], pyqtBoundSignal]"
I guess return value should accept Callable[[], Any], no?