Improved type annotation
@lhoestq  Could someone please take a quick look or let me know if there’s anything I should change? Thanks! could you fix the conflicts ? I think some type annotations have been improved since your first commit It should be good now.
I'm happy to add more annotations or refine further if needed—just let me know!
I've refined several type annotations throughout the codebase to align with current best practices and enhance overall clarity. Given the complexity of the code, there may still be areas that need further attention. I welcome any feedback or suggestions to make these improvements even better.

 - Fixes #7202 