Skip to content

Static typing: APIGatewayRestResolver .post() decorator return type Unknown #3990

Closed
@rafrafek

Description

@rafrafek

Static type checker used

pyright/pylance

AWS Lambda function runtime

3.12

Powertools for AWS Lambda (Python) version

latest

Static type checker info

Latest Pylance, latest VS Code, type checking mode strict.

Untyped function decorator obscures type of function

Screenshot:

image

Code snippet

from aws_lambda_powertools.event_handler import APIGatewayRestResolver

app = APIGatewayRestResolver()

@app.post("/v1/demo")
def demo() -> str:
    return "demo"

Possible Solution

return Callable[..., T] or something like that

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedCould use a second pair of eyes/handsrevisit-in-3-monthsRequires more customers feedback before making or revisiting a decisiontypingStatic 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