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
Analyzer should optionally warn when public methods don't have type annotations #17986
Comments
I've not been a fan of the 'omit dynamic' rule for this reason. It's hard to differentiate between something explicit or something forgotten. Removed Type-Defect label. |
Added Area-Analyzer label. |
Added this to the Later milestone. |
+1 to warnings when public types are not specified. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
I just saw a demo of typescript in VisualStudio where they have the option of treating missing type declarations as "no type" instead of "any" (dynamic), which highlights where you should add type annotations. This is pretty much the flag/mode that is discussed here. Please reconsider the priority for this! |
This comment was originally written by @mezoni Even if this is useful this will be a great contradiction of the basic concept of the proposed Gilad Bracha. If we recognize that it is useful we should turn out that all these years, the whole concept was false. ============ Optional Types in Dart One of the Dart programming language’s most innovative features is the use of optional types. But get warning (as proposed here) should means that a whole concepts are wrong. |
This comment was originally written by beatgammit...@gmail.com
I don't think that's true if it's off by default. Having this tool is very useful when working on a library since it gives a TODO list for documentation. I still think optional types is a very good thing, since it allows rapid iteration in the beginning and documentation when the code stabilizes. Libraries should nearly always be stable, so they should nearly always have complete type annotations. |
This is covered by the linter: type_annotate_public_apis. |
This issue was originally filed by armiller...@google.com
Leaving off type annotations from public methods can be nice for development of a library, but makes the library harder to use. It would be nice if the analyzer could optionally warn/error when public methods/functions don't have type annotations to help encourage library writers to properly annotate their APIs.
The text was updated successfully, but these errors were encountered: