Skip to content

Add Type Hint to Carousel class to satisfy Type Checking#192

Merged
yehuda-lev merged 2 commits intodavid-lev:devfrom
marshmallowsunshinekitten1234:fix/typehint-carousel-for-typecheck
May 1, 2026
Merged

Add Type Hint to Carousel class to satisfy Type Checking#192
yehuda-lev merged 2 commits intodavid-lev:devfrom
marshmallowsunshinekitten1234:fix/typehint-carousel-for-typecheck

Conversation

@marshmallowsunshinekitten1234
Copy link
Copy Markdown

This PR addresses #190, where even the Pylance type checker on the basic setting does not accept a call to pywa.types.templates.Carousel.params without an instance of Carousel, because then type checkers detect Argument of type "None" cannot be assigned to parameter "self" of type "Carousel" in function "params", even though the default for the function is already self=None.

At runtime, there is no issue. This is merely a type checking issue. This was addressed by adding a simple type hint to the function definition.

@yehuda-lev yehuda-lev linked an issue May 1, 2026 that may be closed by this pull request
@yehuda-lev yehuda-lev merged commit 4e8aaea into david-lev:dev May 1, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Usage of self=None in class Carousel triggers type checkers

2 participants