Replies: 3 comments 1 reply
-
Yes, you would need to add the appropriate types to the type stubs. If you're interested in strict typing, it wouldn't make sense to use incomplete or inaccurate type stubs. If you want something less than "strict", you can enable a subset of the diagnostic rules. |
Beta Was this translation helpful? Give feedback.
-
Thanks. Could you advise me on a good subset of rules in my use case? As in, I want all of my own code to be typed (i.e. no unknown types allowed in my files) but allowing for external packages to be unknown. |
Beta Was this translation helpful? Give feedback.
-
There's no way to specify "no unknown types allowed in my files" because usage of types is not constrained to file boundaries. So if you really want no unknown types in your code, you will need properly-annotated type stubs. The whole idea behind the "reportUnknownXXX" diagnostic rules is to ensure that there are no "holes" in your type checking. If you are importing symbols from libraries that don't have properly-annotated types, you will have to live with your type checking being incomplete. |
Beta Was this translation helpful? Give feedback.
-
I have strict mode on and a bunch of my imported modules don't have type stubs. The autogenerated type stubs have no type information, of course, so everything becomes Unknown. But since I'm using strict mode, this leads to a bunch of complaints that stuff in my files are Unknown. Is manually editing everything in the stubs to have type Any the only way to bypass these errors?
Beta Was this translation helpful? Give feedback.
All reactions