Skip to content

Commit 40554fe

Browse files
committed
Fix a regression where boolean logic was flipped
1 parent bd1cb3c commit 40554fe

File tree

8 files changed

+73
-10
lines changed

8 files changed

+73
-10
lines changed

apps/api-extractor/src/enhancers/DocCommentEnhancer.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export class DocCommentEnhancer {
9797

9898
if (symbolMetadata.releaseTag === ReleaseTag.Internal) {
9999
// If the constructor is marked as internal, then add a boilerplate notice for the containing class
100-
101100
const classMetadata: DeclarationMetadata = this._collector.fetchMetadata(classDeclaration);
102101

103102
if (!classMetadata.tsdocComment) {
@@ -153,7 +152,7 @@ export class DocCommentEnhancer {
153152

154153
// Is it referring to the working package? If not, we don't do any link validation, because
155154
// AstReferenceResolver doesn't support it yet (but ModelReferenceResolver does of course).
156-
// TODO: We need to come back and fix this.
155+
// Tracked by: https://github.com/Microsoft/web-build-tools/issues/1195
157156
if (node.codeDestination.packageName === undefined
158157
|| node.codeDestination.packageName === this._collector.workingPackage.name) {
159158

@@ -187,11 +186,13 @@ export class DocCommentEnhancer {
187186
return;
188187
}
189188

190-
// Is it referring to the working package? If not, skip this inheritDoc tag, because
191-
// AstReferenceResolver doesn't support it yet (but ModelReferenceResolver does of course).
192-
// As a workaround, this tag will get handled later by api-documenter.
193-
if (inheritDocTag.declarationReference.packageName === undefined
194-
|| inheritDocTag.declarationReference.packageName === this._collector.workingPackage.name) {
189+
// Is it referring to the working package?
190+
if (!(inheritDocTag.declarationReference.packageName === undefined
191+
|| inheritDocTag.declarationReference.packageName === this._collector.workingPackage.name)) {
192+
193+
// It's referencing an external package, so skip this inheritDoc tag, since AstReferenceResolver doesn't
194+
// support it yet. As a workaround, this tag will get handled later by api-documenter.
195+
// Tracked by: https://github.com/Microsoft/web-build-tools/issues/1195
195196
return;
196197
}
197198

build-tests/api-extractor-scenarios/etc/test-outputs/docReferences/api-extractor-scenarios.api.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,41 @@
187187
}
188188
]
189189
},
190+
{
191+
"kind": "Function",
192+
"canonicalReference": "(succeedForNow:0)",
193+
"docComment": "/**\n * @privateRemarks\n *\n * succeedForNow() should fail due to a broken link, but it's ignored until we fix this issue: https://github.com/Microsoft/web-build-tools/issues/1195\n * {@inheritDoc nonexistent-package#MyNamespace.MyClass.nonExistentMethod}\n *\n * @public\n */\n",
194+
"excerptTokens": [
195+
{
196+
"kind": "Content",
197+
"text": "export declare function "
198+
},
199+
{
200+
"kind": "Reference",
201+
"text": "succeedForNow"
202+
},
203+
{
204+
"kind": "Content",
205+
"text": "(): "
206+
},
207+
{
208+
"kind": "Content",
209+
"text": "void"
210+
},
211+
{
212+
"kind": "Content",
213+
"text": ";"
214+
}
215+
],
216+
"returnTypeTokenRange": {
217+
"startIndex": 3,
218+
"endIndex": 4
219+
},
220+
"releaseTag": "Public",
221+
"overloadIndex": 0,
222+
"parameters": [],
223+
"name": "succeedForNow"
224+
},
190225
{
191226
"kind": "Function",
192227
"canonicalReference": "(testSimple:0)",

build-tests/api-extractor-scenarios/etc/test-outputs/docReferences/api-extractor-scenarios.api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export namespace MyNamespace {
2323
}
2424
}
2525

26+
// @public (undocumented)
27+
export function succeedForNow(): void;
28+
2629
// @public
2730
export function testSimple(): void;
2831

build-tests/api-extractor-scenarios/etc/test-outputs/docReferences/rollup.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ export declare namespace MyNamespace {
2828
}
2929
}
3030

31+
/**
32+
* {@inheritDoc nonexistent-package#MyNamespace.MyClass.nonExistentMethod}
33+
*
34+
* @privateRemarks
35+
* succeedForNow() should fail due to a broken link, but it's ignored until we fix this issue:
36+
* https://github.com/Microsoft/web-build-tools/issues/1195
37+
*
38+
* @public
39+
*/
40+
export declare function succeedForNow(): void;
41+
3142
/**
3243
* {@inheritDoc MyNamespace.MyClass.myMethod}
3344
* @privateRemarks

build-tests/api-extractor-scenarios/etc/test-outputs/docReferences3/api-extractor-scenarios.api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
{
185185
"kind": "Function",
186186
"canonicalReference": "(succeedWithExternalReference:0)",
187-
"docComment": "/**\n * NOTE: The broken link checker currently is not able to validate references to external packages. We need to fix that. {@link nonexistent#nonexistent}\n *\n * @public\n */\n",
187+
"docComment": "/**\n * NOTE: The broken link checker currently is not able to validate references to external packages. Tracked by: https://github.com/Microsoft/web-build-tools/issues/1195 {@link nonexistent#nonexistent}\n *\n * @public\n */\n",
188188
"excerptTokens": [
189189
{
190190
"kind": "Content",

build-tests/api-extractor-scenarios/etc/test-outputs/docReferences3/rollup.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export declare function failWithAmbiguity(): void;
1818

1919
/**
2020
* NOTE: The broken link checker currently is not able to validate references to external packages.
21-
* We need to fix that.
21+
* Tracked by: https://github.com/Microsoft/web-build-tools/issues/1195
2222
* {@link nonexistent#nonexistent}
2323
* @public
2424
*/

build-tests/api-extractor-scenarios/src/docReferences/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ export namespace MyNamespace {
3030
export function testSimple(): void {
3131
}
3232

33+
/**
34+
* {@inheritDoc nonexistent-package#MyNamespace.MyClass.nonExistentMethod}
35+
*
36+
* @privateRemarks
37+
* succeedForNow() should fail due to a broken link, but it's ignored until we fix this issue:
38+
* https://github.com/Microsoft/web-build-tools/issues/1195
39+
*
40+
* @public
41+
*/
42+
export function succeedForNow(): void {
43+
}
44+
45+
3346
/**
3447
* {@inheritDoc MyNamespace.MyClass.nonExistentMethod}
3548
* @public

build-tests/api-extractor-scenarios/src/docReferences3/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function succeedWithSelector() {
3030

3131
/**
3232
* NOTE: The broken link checker currently is not able to validate references to external packages.
33-
* We need to fix that.
33+
* Tracked by: https://github.com/Microsoft/web-build-tools/issues/1195
3434
* {@link nonexistent#nonexistent}
3535
* @public
3636
*/

0 commit comments

Comments
 (0)