Repository: pydantic/pydantic

Issue:
`dataclass` type contains `Any`
### Initial Checks

- [X] I have searched GitHub for a duplicate issue and I'm sure this is something new
- [X] I have searched Google & StackOverflow for a solution and couldn't find anything
- [X] I have read and followed [the docs](https://pydantic-docs.helpmanual.io) and still think this is a bug
- [X] I am confident that the issue is with pydantic  (not my code, or another library in the ecosystem like [FastAPI](https://fastapi.tiangolo.com) or [mypy](https://mypy.readthedocs.io/en/stable))


### Description

i use the `disallow-any-expr` rule in mypy, however the `dataclass` decorator contains `Any` types which means i need to `type:ignore` the error on each usage of the pydantic `dataclass` decorator

### Example Code

```Python
from pydantic.dataclasses import dataclass

@dataclass # error: expression contains Any
class Foo:
    ...
```


### Python, Pydantic & OS Version

```Text
1.9.1
```


### Affected Components

- [ ] [Compatibility between releases](https://pydantic-docs.helpmanual.io/changelog/)
- [ ] [Data validation/parsing](https://pydantic-docs.helpmanual.io/usage/models/#basic-model-usage)
- [ ] [Data serialization](https://pydantic-docs.helpmanual.io/usage/exporting_models/) - `.dict()` and `.json()`
- [ ] [JSON Schema](https://pydantic-docs.helpmanual.io/usage/schema/)
- [X] [Dataclasses](https://pydantic-docs.helpmanual.io/usage/dataclasses/)
- [ ] [Model Config](https://pydantic-docs.helpmanual.io/usage/model_config/)
- [ ] [Field Types](https://pydantic-docs.helpmanual.io/usage/types/) - adding or changing a particular data type
- [ ] [Function validation decorator](https://pydantic-docs.helpmanual.io/usage/validation_decorator/)
- [ ] [Generic Models](https://pydantic-docs.helpmanual.io/usage/models/#generic-models)
- [ ] [Other Model behaviour](https://pydantic-docs.helpmanual.io/usage/models/) - `construct()`, pickling, private attributes, ORM mode
- [ ] [Settings Management](https://pydantic-docs.helpmanual.io/usage/settings/)
- [ ] [Plugins](https://pydantic-docs.helpmanual.io/) and integration with other tools - mypy, FastAPI, python-devtools, Hypothesis, VS Code, PyCharm, etc.


Discussion:

Resolving patch:
diff --git a/pydantic/config.py b/pydantic/config.py
--- a/pydantic/config.py
+++ b/pydantic/config.py
@@ -4,7 +4,7 @@
 
 from typing_extensions import Literal, Protocol
 
-from .typing import AnyCallable
+from .typing import AnyArgTCallable, AnyCallable
 from .utils import GetterDict
 from .version import compiled
 
@@ -62,10 +62,10 @@ class ConfigDict(TypedDict, total=False):
         getter_dict: Type[GetterDict]
         alias_generator: Optional[Callable[[str], str]]
         keep_untouched: Tuple[type, ...]
-        schema_extra: Union[Dict[str, Any], 'SchemaExtraCallable']
-        json_loads: Callable[[str], Any]
-        json_dumps: Callable[..., str]
-        json_encoders: Dict[Type[Any], AnyCallable]
+        schema_extra: Union[Dict[str, object], 'SchemaExtraCallable']
+        json_loads: Callable[[str], object]
+        json_dumps: AnyArgTCallable[str]
+        json_encoders: Dict[Type[object], AnyCallable]
         underscore_attrs_are_private: bool
 
         # whether or not inherited models as fields should be reconstructed as base model
@@ -146,7 +146,7 @@ def prepare_field(cls, field: 'ModelField') -> None:
         pass
 
 
-def get_config(config: Union[ConfigDict, Type[BaseConfig], None]) -> Type[BaseConfig]:
+def get_config(config: Union[ConfigDict, Type[object], None]) -> Type[BaseConfig]:
     if config is None:
         return BaseConfig
 
diff --git a/pydantic/dataclasses.py b/pydantic/dataclasses.py
--- a/pydantic/dataclasses.py
+++ b/pydantic/dataclasses.py
@@ -68,7 +68,7 @@ class Dataclass:
         __pydantic_validate_values__: ClassVar[Callable[['Dataclass'], None]]
         __pydantic_has_field_info_default__: ClassVar[bool]  # whether a `pydantic.Field` is used as default value
 
-        def __init__(self, *args: Any, **kwargs: Any) -> None:
+        def __init__(self, *args: object, **kwargs: object) -> None:
             pass
 
         @classmethod
@@ -88,6 +88,8 @@ def __validate__(cls: Type['DataclassT'], v: Any) -> 'DataclassT':
     'make_dataclass_validator',
 ]
 
+_T = TypeVar('_T')
+
 if sys.version_info >= (3, 10):
 
     @dataclass_transform(kw_only_default=True, field_descriptors=(Field, FieldInfo))
@@ -100,16 +102,16 @@ def dataclass(
         order: bool = False,
         unsafe_hash: bool = False,
         frozen: bool = False,
-        config: Union[ConfigDict, Type[Any], None] = None,
+        config: Union[ConfigDict, Type[object], None] = None,
         validate_on_init: Optional[bool] = None,
         kw_only: bool = ...,
-    ) -> Callable[[Type[Any]], 'DataclassClassOrWrapper']:
+    ) -> Callable[[Type[_T]], 'DataclassClassOrWrapper']:
         ...
 
     @dataclass_transform(kw_only_default=True, field_descriptors=(Field, FieldInfo))
     @overload
     def dataclass(
-        _cls: Type[Any],
+        _cls: Type[_T],
         *,
         init: bool = True,
         repr: bool = True,
@@ -117,7 +119,7 @@ def dataclass(
         order: bool = False,
         unsafe_hash: bool = False,
         frozen: bool = False,
-        config: Union[ConfigDict, Type[Any], None] = None,
+        config: Union[ConfigDict, Type[object], None] = None,
         validate_on_init: Optional[bool] = None,
         kw_only: bool = ...,
     ) -> 'DataclassClassOrWrapper':
@@ -135,15 +137,15 @@ def dataclass(
         order: bool = False,
         unsafe_hash: bool = False,
         frozen: bool = False,
-        config: Union[ConfigDict, Type[Any], None] = None,
+        config: Union[ConfigDict, Type[object], None] = None,
         validate_on_init: Optional[bool] = None,
-    ) -> Callable[[Type[Any]], 'DataclassClassOrWrapper']:
+    ) -> Callable[[Type[_T]], 'DataclassClassOrWrapper']:
         ...
 
     @dataclass_transform(kw_only_default=True, field_descriptors=(Field, FieldInfo))
     @overload
     def dataclass(
-        _cls: Type[Any],
+        _cls: Type[_T],
         *,
         init: bool = True,
         repr: bool = True,
@@ -151,7 +153,7 @@ def dataclass(
         order: bool = False,
         unsafe_hash: bool = False,
         frozen: bool = False,
-        config: Union[ConfigDict, Type[Any], None] = None,
+        config: Union[ConfigDict, Type[object], None] = None,
         validate_on_init: Optional[bool] = None,
     ) -> 'DataclassClassOrWrapper':
         ...
@@ -159,7 +161,7 @@ def dataclass(
 
 @dataclass_transform(kw_only_default=True, field_descriptors=(Field, FieldInfo))
 def dataclass(
-    _cls: Optional[Type[Any]] = None,
+    _cls: Optional[Type[_T]] = None,
     *,
     init: bool = True,
     repr: bool = True,
@@ -167,10 +169,10 @@ def dataclass(
     order: bool = False,
     unsafe_hash: bool = False,
     frozen: bool = False,
-    config: Union[ConfigDict, Type[Any], None] = None,
+    config: Union[ConfigDict, Type[object], None] = None,
     validate_on_init: Optional[bool] = None,
     kw_only: bool = False,
-) -> Union[Callable[[Type[Any]], 'DataclassClassOrWrapper'], 'DataclassClassOrWrapper']:
+) -> Union[Callable[[Type[_T]], 'DataclassClassOrWrapper'], 'DataclassClassOrWrapper']:
     """
     Like the python standard lib dataclasses but with type validation.
     The result is either a pydantic dataclass that will validate input data
diff --git a/pydantic/typing.py b/pydantic/typing.py
--- a/pydantic/typing.py
+++ b/pydantic/typing.py
@@ -19,6 +19,7 @@
     Set,
     Tuple,
     Type,
+    TypeVar,
     Union,
     _eval_type,
     cast,
@@ -76,9 +77,14 @@ def get_all_type_hints(obj: Any, globalns: Any = None, localns: Any = None) -> A
         return get_type_hints(obj, globalns, localns, include_extras=True)
 
 
+_T = TypeVar('_T')
+
 AnyCallable = TypingCallable[..., Any]
 NoArgAnyCallable = TypingCallable[[], Any]
 
+# workaround for https://github.com/python/mypy/issues/9496
+AnyArgTCallable = TypingCallable[..., _T]
+
 
 # Annotated[...] is implemented by returning an instance of one of these classes, depending on
 # python/typing_extensions version.


Test patch:
diff --git a/tests/mypy/configs/mypy-plugin-strict-no-any.ini b/tests/mypy/configs/mypy-plugin-strict-no-any.ini
new file mode 100644
--- /dev/null
+++ b/tests/mypy/configs/mypy-plugin-strict-no-any.ini
@@ -0,0 +1,23 @@
+[mypy]
+plugins = pydantic.mypy
+
+follow_imports = silent
+strict_optional = True
+warn_redundant_casts = True
+warn_unused_ignores = True
+disallow_any_generics = True
+check_untyped_defs = True
+no_implicit_reexport = True
+disallow_untyped_defs = True
+disallow_any_decorated = True
+disallow_any_expr = True
+disallow_any_explicit = True
+disallow_any_unimported = True
+disallow_subclassing_any = True
+warn_return_any = True
+
+[pydantic-mypy]
+init_forbid_extra = True
+init_typed = True
+warn_required_dynamic_aliases = True
+warn_untyped_fields = True
diff --git a/tests/mypy/modules/no_any.py b/tests/mypy/modules/no_any.py
new file mode 100644
--- /dev/null
+++ b/tests/mypy/modules/no_any.py
@@ -0,0 +1,11 @@
+from pydantic.dataclasses import dataclass
+
+
+@dataclass
+class Foo:
+    foo: int
+
+
+@dataclass(config={})
+class Bar:
+    bar: str
diff --git a/tests/mypy/test_mypy.py b/tests/mypy/test_mypy.py
--- a/tests/mypy/test_mypy.py
+++ b/tests/mypy/test_mypy.py
@@ -37,6 +37,7 @@
     ('mypy-default.ini', 'fail3.py', 'fail3.txt'),
     ('mypy-default.ini', 'fail4.py', 'fail4.txt'),
     ('mypy-default.ini', 'plugin_success.py', 'plugin_success.txt'),
+    ('mypy-plugin-strict-no-any.ini', 'no_any.py', None),
     ('pyproject-default.toml', 'success.py', None),
     ('pyproject-default.toml', 'fail1.py', 'fail1.txt'),
     ('pyproject-default.toml', 'fail2.py', 'fail2.txt'),