I am making something that uses the tkinter module and have found that the Widget class has no type hints defined in its methods.
This case is true across files in cpython/Lib/tkinter at main · python/cpython
Sure, I could add # pyright: ignore[reportUnknownMemberType] to the line on VSCode to disable the warning, but it would be great if the module had type hints defined.
Warning:
``Type of “state” is partially unknown
Type of “state” is "(statespec: Unknown | None = None) → Unknown"PylancereportUnknownMemberType
Yes, standard library types are in typeshed. Most types are fairly complete, but tkinter has a lot of functionality and relatively few users, so it’s not always complete. Contributions are welcome!
Generally in typeshed we don’t accept issues that only point out that some items are unannotated. We are aware of that. But we gladly accept PRs that add (or correct) annotations.
I’ll mention as a user who’s used Tk a few times, it was pretty confusing/surprising that anything in the standard library was missing type stubs. For a while, I thought there was something wrong about my venv or Mypy setup because I assumed that the std lib itself would always have its type stubs complete.