Static type checker used
pyright/pylance
AWS Lambda function runtime
3.12
Powertools for AWS Lambda (Python) version
latest
Static type checker info
Expression of type "Dict[str, Any] | None" cannot be assigned to declared type "dict[str, list[str]]"
Type "Dict[str, Any] | None" cannot be assigned to type "dict[str, list[str]]"
"None" is incompatible with "dict[str, list[str]]"
Code snippet
importjsonfromaws_lambda_powertools.event_handler.routerimportALBRouterrouter=ALBRouter()
@router.get("/")defget_headers() ->str:
headers: dict[str, list[str]] =router.current_event.resolved_headers_fieldreturnjson.dumps(headers)
### Possible Solution
Remove `Optional` ```diff
- def resolved_headers_field(self) -> Optional[Dict[str, Any]]:
+ def resolved_headers_field(self) -> Dict[str, Any]:
Static type checker used
pyright/pylance
AWS Lambda function runtime
3.12
Powertools for AWS Lambda (Python) version
latest
Static type checker info
Code snippet