-
Notifications
You must be signed in to change notification settings - Fork 451
Closed
Labels
triagePending triage from maintainersPending triage from maintainerstypingStatic typing definition related issues (mypy, pyright, etc.)Static typing definition related issues (mypy, pyright, etc.)
Description
Static type checker used
pyright/pylance
AWS Lambda function runtime
3.9
Powertools for AWS Lambda (Python) version
latest
Static type checker info
Not running a static type checker but receiving this error from pyright in my editor
Code snippet
`secret = parameters.get_secret('secret_name', transform='json')`
`secret['SECRET']` will cause the following error:
Diagnostics:
1. Argument of type "Literal['SECRET']" cannot be assigned to parameter "__key" of type "SupportsIndex | slice" in function "__getitem__"
Type "Literal['SECRET']" cannot be assigned to type "SupportsIndex | slice"
"Literal['SECRET']" is incompatible with protocol "SupportsIndex"
"__index__" is not present
"Literal['SECRET']" is incompatible with "slice" [reportArgumentType]
2. No overloads for "__getitem__" match the provided arguments [reportCallIssue]
3. Argument of type "Literal['SECRET']" cannot be assigned to parameter "__key" of type "slice" in function "__getitem__"
"Literal['SECRET']" is incompatible with "slice" [reportArgumentType]
### Possible Solution
This should be very similar to #3507 where adding overloads for each transform will fix this.
Metadata
Metadata
Assignees
Labels
triagePending triage from maintainersPending triage from maintainerstypingStatic typing definition related issues (mypy, pyright, etc.)Static typing definition related issues (mypy, pyright, etc.)
Type
Projects
Status
Shipped