Channel.basic_publish does not adhere to it's return type.
Specify that ConfirmationType Future contains ConfirmationFrameType.
Channel.confirmations contains the Futures used by basic_publish, so the Future needs to adhere to the return type of basic_publish.
Setting the type reveals an error in Channel._on_return_frame, which resolves the Future to DeliveredMessage, which is not a ConfirmationFrameType, thus breaking it's contract.
Not sure how to proceed here, tbh., because fixing this can probably be considered a BC-break at this point?
The DeliveredMessage that is wrongly returned by basic_publish can be reproduced by trying to publish to the default_exchange with a routing_key that doesn't match any queue and having on_return_raises=False (which for some reason is the default in aio-pika? :flushed:).
#100 might be related to this.
This not compatible for older python versions as you can see.
Latest commit should fix the incompatibility with old python versions. Sadly had to resort to sys.version_info. I would have preferred hasattr(asyncio.Future, '__getitem__'), but mypy didn't understand that.