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
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
/** * Documentation * @param x - A parameter * @returns A value */exportfunctionfoo(x: number): number;/** * Documentation * @param x - A parameter * @returns A value */exportfunctionfoo(x: string): string;exportfunctionfoo(x: number|string): number|string{returnx;}
with tslint.json configuration (excerpt of relevant rule config):
completed-docs fails on the signature of the implementation of overloaded function foo.
Expected behavior
When a function is overloaded, the signature of the implementation is not a callable signature. It's simply a common signature compatible with all overload signatures so that a single implementation can be written that works with all overload signatures. It is not very useful/necessary to have documentation on the overload implementation, because all usages of the function in code will resolve to one of the overload signatures, and IDEs will present the documentation of the appropriately matched overload signature (and/or will allow the user to toggle between all overload signatures and their documentation). The signature of the implementation itself is never useful to present to the user, because it is not callable.
When a function has multiple signatures (is overloaded), the signature of the implementation itself should not require documentation.
Somewhat related to #4416, yet still probably independent of it.
The text was updated successfully, but these errors were encountered:
TSLint is deprecated and no longer accepting pull requests other than security fixes. See #4534. ☠️
We recommend you instead use typescript-eslint to lint your TypeScript code with ESLint. ✅
Bug Report
TypeScript code being linted
with
tslint.json
configuration (excerpt of relevant rule config):Actual behavior
completed-docs fails on the signature of the implementation of overloaded function
foo
.Expected behavior
When a function is overloaded, the signature of the implementation is not a callable signature. It's simply a common signature compatible with all overload signatures so that a single implementation can be written that works with all overload signatures. It is not very useful/necessary to have documentation on the overload implementation, because all usages of the function in code will resolve to one of the overload signatures, and IDEs will present the documentation of the appropriately matched overload signature (and/or will allow the user to toggle between all overload signatures and their documentation). The signature of the implementation itself is never useful to present to the user, because it is not callable.
When a function has multiple signatures (is overloaded), the signature of the implementation itself should not require documentation.
Somewhat related to #4416, yet still probably independent of it.
The text was updated successfully, but these errors were encountered: