exports is annotated as dict[str, str | tuple[str, str]] (plus the iterable case). Because dict is invariant, passing a simple dict[str, str] actually produces a mypy error! Users can work around this by manually annotating the data as dict[str, str | tuple[str, str]], but this is very unergonomic.
https://github.com/pallets/werkzeug/blob/5add63c955131fd73531d7369f16b2f1b4e342d4/src/werkzeug/middleware/shared_data.py#L102-L113
exports
is annotated asdict[str, str | tuple[str, str]]
(plus the iterable case). Becausedict
is invariant, passing a simpledict[str, str]
actually produces a mypy error! Users can work around this by manually annotating the data asdict[str, str | tuple[str, str]]
, but this is very unergonomic.https://mypy-play.net/?mypy=latest&python=3.12&gist=7194ebea2b603890033453b8d735e232 is a minimal demonstration of this issue, and the recommended workaround: annotating the value as
collections.Mapping
instead.