Closed
Description
Static type checker used
mypy (project's standard)
AWS Lambda function runtime
3.12
Powertools for AWS Lambda (Python) version
latest
Static type checker info
error: Argument "headers" to "Response" has incompatible type "dict[str, str]"; expected
"dict[str, str | list[str]] | None" [arg-type]
headers=headers,
^~~~~~~
note: "Dict" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
note: Consider using "Mapping" instead, which is covariant in the value type
Code snippet
headers = {"str": "str"}
Response(200, headers=headers)
Possible Solution
Instead of Dict[str, Union[str, List[str]]
use Mapping[str, Union[str, List[str]]
.
E.g. https://stackoverflow.com/a/73603324/6621062
Metadata
Metadata
Assignees
Type
Projects
Status
Shipped