Skip to content

Fix type annotations for models#520

Closed
golyalpha wants to merge 1 commit intoredis:mainfrom
golyalpha:patch-1
Closed

Fix type annotations for models#520
golyalpha wants to merge 1 commit intoredis:mainfrom
golyalpha:patch-1

Conversation

@golyalpha
Copy link
Copy Markdown

Classmethods get type annotations declared their return type as the various base model classes.

This broke code hints and linters as a result, because they were incorrectly told Model.get returned HashModel (or whichever base model was in use) rather than Model.

Classmethods `get` type annotations declared their return type as the various base model classes.

This broke code hints and linters as a result, because they were incorrectly told Model.get returned `HashModel` (or whichever base model was in use) rather than `Model`.
@abrookins
Copy link
Copy Markdown
Collaborator

Closing this PR due to staleness (18 months), but the improvement is valid and now tracked in #742.

Thank you @golyalpha for identifying this typing issue! The approach of using a TypeVar for proper return type inference is correct. We'll reference this PR when implementing the fix.

See #742 for continued discussion.

@abrookins abrookins closed this Dec 24, 2025
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.

2 participants