Open kasium opened 1 year ago
I'd strongly support this suggestion!
Based on my testing, this was added in Invoke 2.1.2.
E.g. the type of this statement differs between:
result = c.run(f"ruff check . {'--fix' if auto_fix else ''}", warn=True)
The type of this is:
2.1.1: Result
2.1.2: Result | None
The current type hints suggests that we should always guard against None
as a return type, making the code much more verbose. I don't know enough about async to know to which extent this is avoidable, but adding guards every time we get a return object is very costly to readability and maintainability. Would love to know your take on this, @bitprophet.
According to the types,
output = context.run("echo")
returns possibly None, which makes sense for asynchronous tasks. For this example, the types are wrong, since never None could be returned. Can you please add an overload improving it?