Closed
Description
In order to keep code type safe and declare that my code will work with any type, I have used object
. But, when trying to use a TypeVar
in another part of the code, it complains that it is incompatible with object
.
My code looks roughly like:
jobs: Set[Job[object]] = set()
async def spawn(self, coro: Coroutine[object, object, _T]) -> Job[_T]:
jobs.add(job)
I'm getting:
error: Argument 1 to "add" of "set" has incompatible type "Job[_T]"; expected "Job[object]" [arg-type]
I don't think it's an invariance problem..