**To Reproduce** Using a class with a generic type that is returned in a method as a `type[T]` does not work properly in isinstance narrowing checks: https://mypy-play.net/?mypy=latest&python=3.12&gist=dd509c91ecf07303e62a00d2d6646345 **Expected Behavior** mypy should narrow the union and no error should be emitted. - ty does the right thing: https://play.ty.dev/2badea13-87aa-46d0-b415-28c98c54b6ac - pyright has a similar issue to mypy **Actual Behavior** mypy does not narrow the type correctly: ``` main.py:27: error: Item "A" of "A | B" has no attribute "b_only" [union-attr] ```
To Reproduce
Using a class with a generic type that is returned in a method as a
type[T]does not work properly in isinstance narrowing checks:https://mypy-play.net/?mypy=latest&python=3.12&gist=dd509c91ecf07303e62a00d2d6646345
Expected Behavior
mypy should narrow the union and no error should be emitted.
Actual Behavior
mypy does not narrow the type correctly: