From bfb4a0fe7b5123835bba9ff602bcb7fa7006df32 Mon Sep 17 00:00:00 2001 From: Tibor Reiss <75096465+tibor-reiss@users.noreply.github.com> Date: Thu, 16 May 2024 22:54:10 +0200 Subject: [PATCH] docs: TYPE_CHECKING for injected types (#3502) --- docs/usage/dependency-injection.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/usage/dependency-injection.rst b/docs/usage/dependency-injection.rst index 114bf3fa91..b709ed326b 100644 --- a/docs/usage/dependency-injection.rst +++ b/docs/usage/dependency-injection.rst @@ -53,6 +53,14 @@ the application: The above example illustrates how dependencies are declared on the different layers of the application. +.. note:: + + Litestar needs the injected types at runtime which might clash with linter rules' recommendation to use ``TYPE_CHECKING``. + + .. seealso:: + + :ref:`Signature namespace ` + Dependencies can be either callables - sync or async functions, methods, or class instances that implement the :meth:`object.__call__` method, or classes. These are in turn wrapped inside an instance of the :class:`Provide <.di.Provide>` class.