diff --git a/mypy/plugins/dataclasses.py b/mypy/plugins/dataclasses.py
--- a/mypy/plugins/dataclasses.py
+++ b/mypy/plugins/dataclasses.py
@@ -5,7 +5,7 @@
 
 from mypy.nodes import (
     ARG_OPT, ARG_NAMED, ARG_NAMED_OPT, ARG_POS, ARG_STAR, ARG_STAR2, MDEF,
-    Argument, AssignmentStmt, CallExpr,    Context, Expression, JsonDict,
+    Argument, AssignmentStmt, CallExpr,  TypeAlias,  Context, Expression, JsonDict,
     NameExpr, RefExpr, SymbolTableNode, TempNode, TypeInfo, Var, TypeVarExpr,
     PlaceholderNode
 )
@@ -333,6 +333,20 @@ def collect_attributes(self) -> Optional[List[DataclassAttribute]]:
 
             node = sym.node
             assert not isinstance(node, PlaceholderNode)
+
+            if isinstance(node, TypeAlias):
+                ctx.api.fail(
+                    (
+                        'Type aliases inside dataclass definitions '
+                        'are not supported at runtime'
+                    ),
+                    node
+                )
+                # Skip processing this node. This doesn't match the runtime behaviour,
+                # but the only alternative would be to modify the SymbolTable,
+                # and it's a little hairy to do that in a plugin.
+                continue
+
             assert isinstance(node, Var)
 
             # x: ClassVar[int] is ignored by dataclasses.

diff --git a/test-data/unit/check-dataclasses.test b/test-data/unit/check-dataclasses.test
--- a/test-data/unit/check-dataclasses.test
+++ b/test-data/unit/check-dataclasses.test
@@ -513,6 +513,34 @@ Application.COUNTER = 1
 
 [builtins fixtures/dataclasses.pyi]
 
+[case testTypeAliasInDataclassDoesNotCrash]
+# flags: --python-version 3.7
+from dataclasses import dataclass
+from typing import Callable
+from typing_extensions import TypeAlias
+
+@dataclass
+class Foo:
+    x: int
+
+@dataclass
+class One:
+    S: TypeAlias = Foo  # E: Type aliases inside dataclass definitions are not supported at runtime
+
+a = One()
+reveal_type(a.S)  # N: Revealed type is "def (x: builtins.int) -> __main__.Foo"
+a.S()  # E: Missing positional argument "x" in call to "Foo"
+reveal_type(a.S(5))  # N: Revealed type is "__main__.Foo"
+
+@dataclass
+class Two:
+    S: TypeAlias = Callable[[int], str]  # E: Type aliases inside dataclass definitions are not supported at runtime
+
+c = Two()
+x = c.S  # E: Member "S" is not assignable
+reveal_type(x)  # N: Revealed type is "Any"
+[builtins fixtures/dataclasses.pyi]
+
 [case testDataclassOrdering]
 # flags: --python-version 3.7
 from dataclasses import dataclass

Crash when using `TypeAlias` inside a dataclass
**Crash Report**

The following snippet of code causes a crash:

```python
from dataclasses import dataclass
from typing import TypeAlias

class Foo:
    x = 1

@dataclass
class A:
    ShortName: TypeAlias = Foo
    var: int = ShortName.x
```

It [doesn't work as expected at runtime](https://github.com/python/typing/discussions/1124), but it also probably shouldn't cause mypy to crash.

**Traceback**

```
test.py:8: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.950+dev.222029b07e0fdcb3c174f15b61915b3b2e1665ca
Traceback (most recent call last):
  File "C:\Users\alexw\coding\mypy\venv\Scripts\mypy-script.py", line 33, in <module>
    sys.exit(load_entry_point('mypy', 'console_scripts', 'mypy')())
  File "c:\users\alexw\coding\mypy\mypy\__main__.py", line 12, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "c:\users\alexw\coding\mypy\mypy\main.py", line 96, in main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File "c:\users\alexw\coding\mypy\mypy\main.py", line 173, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "c:\users\alexw\coding\mypy\mypy\build.py", line 180, in build
    result = _build(
  File "c:\users\alexw\coding\mypy\mypy\build.py", line 256, in _build
    graph = dispatch(sources, manager, stdout)
  File "c:\users\alexw\coding\mypy\mypy\build.py", line 2733, in dispatch
    process_graph(graph, manager)
  File "c:\users\alexw\coding\mypy\mypy\build.py", line 3081, in process_graph
    process_stale_scc(graph, scc, manager)
  File "c:\users\alexw\coding\mypy\mypy\build.py", line 3173, in process_stale_scc
    mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
  File "c:\users\alexw\coding\mypy\mypy\semanal_main.py", line 78, in semantic_analysis_for_scc
    process_top_levels(graph, scc, patches)
  File "c:\users\alexw\coding\mypy\mypy\semanal_main.py", line 199, in process_top_levels
    deferred, incomplete, progress = semantic_analyze_target(next_id, state,
  File "c:\users\alexw\coding\mypy\mypy\semanal_main.py", line 326, in semantic_analyze_target
    analyzer.refresh_partial(refresh_node,
  File "c:\users\alexw\coding\mypy\mypy\semanal.py", line 414, in refresh_partial
    self.refresh_top_level(node)
  File "c:\users\alexw\coding\mypy\mypy\semanal.py", line 425, in refresh_top_level
    self.accept(d)
  File "c:\users\alexw\coding\mypy\mypy\semanal.py", line 5281, in accept
    node.accept(self)
  File "c:\users\alexw\coding\mypy\mypy\nodes.py", line 1021, in accept
    return visitor.visit_class_def(self)
  File "c:\users\alexw\coding\mypy\mypy\semanal.py", line 1120, in visit_class_def
    self.analyze_class(defn)
  File "c:\users\alexw\coding\mypy\mypy\semanal.py", line 1200, in analyze_class
    self.analyze_class_body_common(defn)
  File "c:\users\alexw\coding\mypy\mypy\semanal.py", line 1209, in analyze_class_body_common
    self.apply_class_plugin_hooks(defn)
  File "c:\users\alexw\coding\mypy\mypy\semanal.py", line 1255, in apply_class_plugin_hooks
    hook(ClassDefContext(defn, decorator, self))
  File "c:\users\alexw\coding\mypy\mypy\plugins\dataclasses.py", line 521, in dataclass_class_maker_callback
    transformer.transform()
  File "c:\users\alexw\coding\mypy\mypy\plugins\dataclasses.py", line 121, in transform
    attributes = self.collect_attributes()
  File "c:\users\alexw\coding\mypy\mypy\plugins\dataclasses.py", line 327, in collect_attributes
    assert isinstance(node, Var)
AssertionError:
```

**To Reproduce**

Paste the code above into a `.py` file, run mypy on it. Also reproduced [on mypy playground](https://mypy-play.net/?mypy=latest&python=3.10&flags=show-traceback&gist=8d5e69cc29a4823717a6f377244c121e).


mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBadInit mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasic mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultFactoryTypeChecking mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDeepInitVarInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesCustomInit mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultOrdering mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesMultiInit mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOverriding mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnly mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasicInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesMultiInitDefaults mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOverridingWithDefaults mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaults mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyOnField mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDeepInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesFreezing mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyOnFieldFalse mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultFactories mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesMultipleInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesFields mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassOrderingWithCustomMethods mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyWithSentinel mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOverloadsAndClassmethods mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyWithSentinelAndFieldOverride mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassDefaultsInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesClassVars mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassMultiGenericInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyWithSentinelAndSubclass mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericsClassmethod mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenerics mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesForwardRefs mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassUntypedGenericInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyWithMultipleSentinel mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVars mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericSubtype mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesClassmethods mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarsAndDefer mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testNoComplainFieldNone mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarOverride mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesNoInitInitVarInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testNoComplainFieldNoneStrict mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarNoOverride mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDisallowUntypedWorksForward mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFactory mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassOrdering mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarPostInitOverride mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDisallowUntypedWorksForwardBad mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testMemberExprWorksAsField mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassOrderingWithoutEquality mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldDeferredFrozen mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDeferredDataclassInitSignatureSubclass mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassOrderingDeferred mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testTypeInDataclassDeferredStar mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarIncremental mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldDeferred mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDeferredDataclassInitSignature mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultsIncremental mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultsMroOtherFile mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassHasAttributeWithFields mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassCallableAssignment mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassInheritanceNoAnnotation mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInheritingDuplicateField mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassCallableProperty mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassCallablePropertyWrongType mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassInheritanceNoAnnotation2 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassCallablePropertyWrongTypeAssignment mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldDoesNotFailOnKwargsUnpacking mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldWithPositionalArguments mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassWithSlotsArg mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldWithTypedDictUnpacking mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassWithSlotsDef mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassWithSlotsConflict mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses1 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassWithSlotsArgBefore310 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses2 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses3 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses4 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesAnyInherit mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesCallableFrozen mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesMultipleInheritanceWithNonDataclass mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassInheritOptionalType mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericInheritance2 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericInheritanceSpecialCase2 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericInheritanceSpecialCase1 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericWithBound
mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testTypeAliasInDataclassDoesNotCrash