title: How do I get Python dataclass InitVar fields to work with typing.get_type_hints while also using annotations?
body: <p>When messing with Python dataclasses, I ran into this odd error that's pretty easy to reproduce.</p>
  <pre class="lang-py prettyprint-override"><code>from __future__ import annotations
  
  import dataclasses as dc
  import typing
  
  @dc.dataclass
  class Test:
      foo: dc.InitVar[int]
  
  print(typing.get_type_hints(Test))
  </code></pre>
  <p>Running this gets you the following:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;test.py&quot;, line 11, in &lt;module&gt;
      print(typing.get_type_hints(Test))
    File &quot;C:\Program Files\Python310\lib\typing.py&quot;, line 1804, in get_type_hints
      value = _eval_type(value, base_globals, base_locals)
    File &quot;C:\Program Files\Python310\lib\typing.py&quot;, line 324, in _eval_type
      return t._evaluate(globalns, localns, recursive_guard)
    File &quot;C:\Program Files\Python310\lib\typing.py&quot;, line 687, in _evaluate
      type_ =_type_check(
    File &quot;C:\Program Files\Python310\lib\typing.py&quot;, line 173, in _type_check
      raise TypeError(f&quot;{msg} Got {arg!r:.100}.&quot;)
  TypeError: Forward references must evaluate to types. Got dataclasses.InitVar[int].
  </code></pre>
  <p>Without <code>from __future__ import annotations</code>, it seems to work fine; but in the actual code I'm making use of that import in a couple different type hints. Is there no way to make it so that the annotations import doesn't break this?</p>