mypy "is not valid as a type" for types constructed with type() : <pre><code>Foo = type('Foo', (), {})
Bar = Optional[Foo]
</code></pre>

<p>mypy complains <code>error: Variable "packagename.Foo" is not valid as a type</code></p>

<p>Is there a way around this besides doing</p>

<pre><code>Class Foo:
    pass

Bar = Optional[Foo]
</code></pre>

<p>?</p>
