File tree Expand file tree Collapse file tree
api-documenter/src/documenters Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -793,7 +793,7 @@ export class MarkdownDocumenter {
793793 // For overloaded methods, add a suffix such as "MyClass.myMethod_2".
794794 let qualifiedName : string = hierarchyItem . displayName ;
795795 if ( ApiParameterListMixin . isBaseClassOf ( hierarchyItem ) ) {
796- if ( hierarchyItem . overloadIndex > 0 ) {
796+ if ( hierarchyItem . overloadIndex > 1 ) {
797797 qualifiedName += `_${ hierarchyItem . overloadIndex } ` ;
798798 }
799799 }
Original file line number Diff line number Diff line change @@ -526,7 +526,7 @@ export class YamlDocumenter {
526526 // For overloaded methods, add a suffix such as "MyClass.myMethod_2".
527527 let qualifiedName : string = hierarchyItem . displayName ;
528528 if ( ApiParameterListMixin . isBaseClassOf ( hierarchyItem ) ) {
529- if ( hierarchyItem . overloadIndex > 0 ) {
529+ if ( hierarchyItem . overloadIndex > 1 ) {
530530 qualifiedName += `_${ hierarchyItem . overloadIndex } ` ;
531531 }
532532 }
Original file line number Diff line number Diff line change @@ -60,16 +60,21 @@ export interface ApiParameterListMixin extends ApiItem {
6060 *
6161 * ```ts
6262 * export namespace Versioning {
63+ * // TSDoc: Versioning.(addVersions:1)
6364 * export function addVersions(x: number, y: number): number;
65+ *
66+ * // TSDoc: Versioning.(addVersions:2)
6467 * export function addVersions(x: string, y: string): string;
68+ *
69+ * // (implementation)
6570 * export function addVersions(x: number|string, y: number|string): number|string {
6671 * // . . .
6772 * }
6873 * }
6974 * ```
7075 *
7176 * In the above example, there are two overloaded declarations. The overload using numbers will have
72- * `overloadIndex = 0 `. The overload using strings will have `overloadIndex = 1 `. The third declaration that
77+ * `overloadIndex = 1 `. The overload using strings will have `overloadIndex = 2 `. The third declaration that
7378 * accepts all possible inputs is considered part of the implementation, and is not processed by API Extractor.
7479 */
7580 readonly overloadIndex : number ;
Original file line number Diff line number Diff line change @@ -724,7 +724,8 @@ export class ApiModelGenerator {
724724 let overloadIndex : number | undefined = this . _cachedOverloadIndexesByDeclaration . get ( astDeclaration ) ;
725725
726726 if ( overloadIndex === undefined ) {
727- let nextIndex : number = 0 ;
727+ // TSDoc index selectors are positive integers counting from 1
728+ let nextIndex : number = 1 ;
728729 for ( const other of allDeclarations ) {
729730 // Filter out other declarations that are not overloads. For example, an overloaded function can also
730731 // be a namespace.
You can’t perform that action at this time.
0 commit comments