Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tonnico opened this issue Feb 23, 2024 · 3 comments · Fixed by #3840
Closed
Assignees
Labels
typing Static typing definition related issues (mypy, pyright, etc.)

Comments

@tonnico
Copy link
Contributor

tonnico commented Feb 23, 2024

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

@tonnico tonnico added triage Pending triage from maintainers typing Static typing definition related issues (mypy, pyright, etc.) labels Feb 23, 2024
@heitorlessa heitorlessa self-assigned this Feb 23, 2024
@heitorlessa heitorlessa removed the triage Pending triage from maintainers label Feb 23, 2024
@heitorlessa
Copy link
Contributor

pending CI checks ;)

@heitorlessa heitorlessa moved this from Triage to Coming soon in Powertools for AWS Lambda (Python) Feb 23, 2024
@heitorlessa heitorlessa linked a pull request Feb 23, 2024 that will close this issue
7 tasks
@heitorlessa heitorlessa added the pending-release Fix or implementation already in dev waiting to be released label Feb 23, 2024
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@heitorlessa heitorlessa moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Feb 26, 2024
Copy link
Contributor

This is now released under 2.34.2 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typing Static typing definition related issues (mypy, pyright, etc.)
Projects
Status: Shipped
Development

Successfully merging a pull request may close this issue.

2 participants