type hint for an instance of a non specific dataclass : <p>I have a function that accepts an instance of any <code>dataclass</code>.
what would be an appropriate type hint for it ?</p>

<p>haven't found something official in the python documentation </p>

<hr>

<p>this is what I have been doing, but i don't think it's correct</p>

<pre><code>from typing import Any, NewType

DataClass = NewType('DataClass', Any)
def foo(obj: DataClass):
    ...
</code></pre>

<p>another idea is to use a <a href="https://www.python.org/dev/peps/pep-0544/#defining-a-protocol" rel="noreferrer"><code>Protocol</code></a> with these class attributes <code>__dataclass_fields__</code>, <code>__dataclass_params__</code>.</p>
