BUG: Too aggressive typing in NDFrame.align
- [x] closes #31785

The type checking was too aggressive. ``right`` has type ``Any``, so the wrapping in ``_ensure_type`` should not be done.
> The type checking was too aggressive

Is this in reference to annotations or to runtime type checking? > Is this in reference to annotations or to runtime type checking?

It's type checking, but can spill over to the run time because an ``assert`` is used to enforce the type, (that's what the call to ``._ensure_type`` does). Without ``._ensure_type`` the type of left would be ``Optional[DataFrame]`` and mypy would complain of operations on None.

 Do any of the other usage of `_ensure_types` introduced in the PR also need fixing? There should`t be more; here I assumed that left and right should be treated alike, which was a wrong idea. Ok, I've added a test. thanks can we open an issue about how to improve / fix _ensure_type to make things like this work?