Skip to content

Commit

Permalink
Add a note on the types locality
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 3, 2025
1 parent 15ef38c commit 8bb13e2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/tags/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

The ``types`` tag declares the types of template variables.

.. note::

The types declared in a template are local to that template and must not be
propagated to included templates. This is because a template can be
included from multiple different places, each potentially having different
variable types.

To do this, specify a :ref:`mapping <twig-expressions>` of names to their types as strings.

Here is how to declare that ``is_correct`` is a boolean, while ``score`` is a number (see note below):
Expand Down

0 comments on commit 8bb13e2

Please sign in to comment.