RocketPy-Team / RocketPy

Next generation High-Power Rocketry 6-DOF Trajectory Simulation
https://docs.rocketpy.org/
MIT License
570 stars 137 forks source link

BUG: Fix minor type hinting problems #598

Closed nalquas closed 1 month ago

nalquas commented 1 month ago

Pull request type

Checklist

Current behavior

Assume basic type checking is active in VSCode. If you try to assign a float to one of the following function parameters, you get a warning that float is not compatible with int:

The reason for the warning seems to be that the default values for those parameters is an integer, so the type checker assumes only ints are supported.

New behavior

No warning is given when a float is assigned to the listed parameters. Furthermore, no warning is given when assigning an int (just like before), because casting an int to a float does not warrant a warning for the type checker.

Breaking change

Additional information

When not using type hinting, the changes should not have any effect, as I have only added a ".0" to the end of the affected ints.

The docs/comments in the code even say that the mentioned parameters support float, but the type checker in VSCode didn't care 😅.

There are likely many more such cases; this PR only covers parameters that I came across so far (so I don't have to see those warnings in the project I work on). A proper solution would be to actually add type hints to everything in the repository.

I am aware of #444, where it was decided that type hinting will not be actively supported in this repository due to too much development overhead.