2 ms·
Bad: - Omitting return types in non-private interfaces (eg crossing module or package boundaries, or anything used as input to generate documentation of same)
by eyelidlessness 3y ago
Bad:
- Omitting return types in non-private interfaces (eg crossing module or package boundaries, or anything used as input to generate documentation of same)
- Omitting concrete input parameter types
- Omitting explicit, known constraints on generic/polymorphic parameters
Subjective:
- Omitting any of the same on private equivalents which form something like an internal interface
- Omitting annotations of constant/static aspects of an interface whose inferred types are identical to their hypothetical annotation
Subjective but mostly good:
- Relying on inference in type derivation, where type derivation is the explicit goal of that API
- Preferring inference of interface/protocol/contract types over explicit annotation of concrete types which happen to satisfy them
- Omitting annotations for local bindings without distant indirection
Unambiguously good:
- Omitting local annotations of direct assignment where the type is obvious in situ
- Omitting redundant annotations of the same type which have the same effect without that redundancy