-
Notifications
You must be signed in to change notification settings - Fork 217
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
Fix: FindInterface type-hints break on View models #819
Fix: FindInterface type-hints break on View models #819
Conversation
Hi @GuyGooL5 , |
Hi @roman-right, unfortunately I've found that my solution isn't all-inclusive and there are many edge cases, I'm drafting this PR and will work on it. |
Hi @GuyGooL5 , |
@@ -1012,7 +1012,8 @@ def get_previous_changes(self) -> Dict[str, Any]: | |||
return {} | |||
|
|||
return self._collect_updates( | |||
self._previous_saved_state, self._saved_state # type: ignore | |||
self._previous_saved_state, | |||
self._saved_state, # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this has nothing to do with the PR, it was simply auto-formatted.
@roman-right I hope that's enough for a fix. I tested the type inference in VSCode and it seems to work, is there maybe a test I can implement to future-proof it from a static-type checker's perspective? |
Hi @GuyGooL5 , |
Hi @GuyGooL5 , |
Great news, thanks. |
This PR adds a new TypeVar for
View
just likeDocType
, and is used inFindInterface
to bind it for each model with their respective model type.It fixes a bug where find operations type-checks break when used with
View
descendants. For example, see this issue.