Skip to content

Commit

Permalink
feat: update typing for register
Browse files Browse the repository at this point in the history
  • Loading branch information
octo-gone committed Aug 10, 2024
1 parent 209b32c commit f1c3346
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "jinja2-components"
version = "0.0.3"
version = "0.0.4"
description = "Streamlined way to build and reuse your Jinja2 templates from code"
authors = ["octo-gone <[email protected]>"]
readme = "README.md"
Expand Down
4 changes: 3 additions & 1 deletion src/jinja2_components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
from jinja2_components.component import Component
from jinja2_components.ext import ComponentsExtension

TComponent = t.TypeVar("TComponent", bound=Component)


def register(
name: str,
ext_base_cls: t.Type[ComponentsExtension] = ComponentsExtension,
):
def _register_component(cls: t.Type[Component]):
def _register_component(cls: t.Type[TComponent]) -> t.Type[TComponent]:
ext_base_cls.tags.add(name)
ext_base_cls.components[name] = cls
return cls
Expand Down

0 comments on commit f1c3346

Please sign in to comment.