pallets/flask

Type hint for FlaskCliRunner.invoke is not specific

Closed this issue · 1 comments

The type hint of the return type of FlaskCliRunner.invoke ist typing.Any but should use click.testing.Result. This leads to missing auto completions in the IDE as well as errors from the type checker if not additional type narrowing is done.

The Problem is here: https://github.com/pallets/flask/blob/main/src/flask/testing.py#L276

To fix this Result must be imported from click.testing and used as a return type annotation.

The documentation already specifies click.testing.Result as return type.

Environment:

  • Python version: 3.12.2
  • Flask version: 3.1.0 but is also present in current main branch.

@davidism @pgjones @tachyondecay @carc1n0gen @ThiefMaster @jab @greyli Can I work on this issue as I had been working for it for quite a while and think I got lead to the solution for this issue you wanted !