diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py index f22815555e..fc09829c94 100644 --- a/astroid/nodes/node_classes.py +++ b/astroid/nodes/node_classes.py @@ -4010,7 +4010,7 @@ def getitem(self, index, context: InferenceContext | None = None): return _container_getitem(self, self.elts, index, context=context) -class TypeAlias(_base_nodes.AssignTypeNode): +class TypeAlias(_base_nodes.AssignTypeNode, _base_nodes.Statement): """Class representing a :class:`ast.TypeAlias` node. >>> import astroid diff --git a/tests/test_type_params.py b/tests/test_type_params.py index b5827010cd..6ce5e6877a 100644 --- a/tests/test_type_params.py +++ b/tests/test_type_params.py @@ -35,6 +35,8 @@ def test_type_alias() -> None: assert node.inferred()[0] is node assert node.type_params[0].inferred()[0] is node.type_params[0] + assert node.statement() is node + def test_type_param_spec() -> None: node = extract_node("type Alias[**P] = Callable[P, int]")