title: How do I tell PyCharm user defined type of python dict in a function is okay?
body: <p>The code below runs fine, no warnings, with python 3.7.4.</p>
  
  <pre><code>from typing import Any, Dict, NewType
  
  DocType = NewType('DocType', Dict[str, Any])
  
  def print_doc(doc: DocType):
      for key, val in doc.items():
          print("key %s val %s" % (key, val))
  
  print_doc({'a': 1, 'b': '2'})
  </code></pre>
  
  <p>However, in PyCharm (community 2019.2) I get a warning on the last line:</p>
  
  <pre><code>Expected type 'DocType', got 'Dict[str, Union[int, str]]' instead.
  </code></pre>
  
  <p>How can I inform PyCharm everything's okay?</p>
  
  <p>The options PyCharm offers are to suppress the check for that line, and to turn off type checking altogether.  Neither seems great.</p>
  
  <p><strong>EDIT</strong>: If instead of defining my own DocType, I put <code>Dict[str, Any]</code> in the function prototype, the warning goes away.  I guess that's a workaround.</p>