basedpyright gives 'Type of "connect" is partially unknown' on PyQt6 connect
07:17 28 Dec 2025

When I use a signal's connect method, basedpyright gives a warning. I use the signal as is in the documentation: some_object.someSignal.connect(some_callable). It works, the only problem is the warning. I get a similar warning in PyQt5, but this part has been significantly rewritten, so I focus on PyQt6 now. The full error message is the following:

Type of "connect" is partially unknown
  Type of "connect" is "(slot: Unknown | pyqtBoundSignal) -> Connection" [reportUnknownMemberType]

PyQt6's interface definition file has the following:

class pyqtBoundSignal:
(...)
    def connect(self, slot: 'PYQT_SLOT') -> 'QMetaObject.Connection': ...
(...)

PYQT_SLOT = typing.Union[collections.abc.Callable[..., Any], pyqtBoundSignal]

It looks to me like the problem is that basedpyright doesn't recognize collections.abc.Callable. Why is that? mypy doesn't have any problem with the code. What's the difference between collections.abc.Callable and typing.Callable? Is this a bug in PyQt6 or basedpyright? Is there any workaround besides turning off reportUnknownMemberType? I don't want to turn the warning off entirely because it can be useful at other places.

python pyqt pyqt6 pyright