Skip to content

Add type annotation for FILTERS dict#2148

Closed
r266-tech wants to merge 1 commit intopallets:mainfrom
r266-tech:fix/filter-type-annotation
Closed

Add type annotation for FILTERS dict#2148
r266-tech wants to merge 1 commit intopallets:mainfrom
r266-tech:fix/filter-type-annotation

Conversation

@r266-tech
Copy link
Copy Markdown

@r266-tech r266-tech commented Mar 22, 2026

Fixes #2120

Problem

The FILTERS dict in src/jinja2/filters.py was missing a type annotation, causing Pylance to report partially unknown types for Environment.filters.

Solution

Added the type annotation dict[str, F] using the existing F TypeVar defined at line 44 of the same file.

Change

-FILTERS = {
+FILTERS: dict[str, F] = {

Fixes #2120

The FILTERS dict was missing a type annotation, causing Pylance
to report partially unknown types for Environment.filters. This
adds the annotation using the existing F TypeVar.
@davidism davidism closed this Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing type annotation for FILTERS

3 participants