Describe the bug
A type that was defined with the new Python 3.12 type A = B syntax, produces a wrong return type from a generic function, when the return type is defined from a type alias object.
Code or Screenshots
from typing import Any
import numpy as np
type F64Arr2D = np.ndarray[tuple[int, int], np.dtype[np.float64]]
def check_type[T](t: type[T], obj: Any) -> T:
# custom runtime type checking
return obj
a = check_type(F64Arr2D, np.array([[2.5, 3.5], [1.5, 1.0]]))
reveal_type(a) # Type of "a" is "TypeAliasType"
Expected behaviour
Type of a should be inferred as ndarray[tuple[int, int], dtype[floating[_64Bit]]
VS Code extension or command-line
Running pyright 1.1.348 as a language server with neovim 0.9.5