Skip to content

Static typing: missing @overload to ensure return type is a str when default_value is set #3839

Closed
@tonnico

Description

@tonnico

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 "str | None" cannot be assigned to declared type "str"

Code snippet

header_value: str = event.get_header_value("name", "")

Possible Solution

@overload

Metadata

Metadata

Assignees

Labels

typingStatic typing definition related issues (mypy, pyright, etc.)

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions