You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the VS Code Pylance type checker, I'm unable to run queries without giving me type errors. For example, just running db.search(where("field") == field) gives me the error:
Argument of type "QueryInstance" cannot be assigned to parameter "cond" of type "QueryLike" in function "search"
"QueryInstance" is incompatible with protocol "QueryLike"
"__hash__" is an incompatible type
Type "() -> int" cannot be assigned to type "() -> None"
Function return type "int" is incompatible with type "None"
Type cannot be assigned to type "None"Pylance[reportGeneralTypeIssues](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportGeneralTypeIssues)
I can fix this if I go into queries.QueryLike, and replace def __hash__(self): ... with def __hash__(self) -> int: ...
If we made this change, would it break other code (e.g. MyPy) in any way?
The text was updated successfully, but these errors were encountered:
Seems like MyPy wasn't too upset about this, so I've added this change in b431412 🙂 (Note that the CI pipeline fails due to issues unrelated to this change). Will be released in the next TinyDB version
Oh, turns out I was referring to a line which was already fixed in fcb1a86, just that that change hasn't been released yet so it never showed up on my end. Thanks for the quick reply!
Using the VS Code Pylance type checker, I'm unable to run queries without giving me type errors. For example, just running
db.search(where("field") == field)
gives me the error:I can fix this if I go into
queries.QueryLike
, and replacedef __hash__(self): ...
withdef __hash__(self) -> int: ...
If we made this change, would it break other code (e.g. MyPy) in any way?
The text was updated successfully, but these errors were encountered: