diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ed68dc053c240..8a6743090f9dc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -500,8 +500,8 @@ namespace ts { visitNode(cbNode, (node as JSDocPropertyLikeTag).typeExpression) || (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) : visitNode(cbNode, (node as JSDocPropertyLikeTag).typeExpression) || - visitNode(cbNode, (node as JSDocPropertyLikeTag).name)) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + visitNode(cbNode, (node as JSDocPropertyLikeTag).name) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined))); case SyntaxKind.JSDocAuthorTag: return visitNode(cbNode, (node as JSDocTag).tagName) || (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); diff --git a/src/testRunner/unittests/publicApi.ts b/src/testRunner/unittests/publicApi.ts index e299f0c339da5..e1400a9992c9e 100644 --- a/src/testRunner/unittests/publicApi.ts +++ b/src/testRunner/unittests/publicApi.ts @@ -150,6 +150,24 @@ describe("unittests:: Public APIs:: validateLocaleAndSetLanguage", () => { }, errors); }); } - ts.supportedLocaleDirectories.forEach(locale => verifyValidateLocale(locale, /*expctedToReadFile*/ true)); - ["en", "en-us"].forEach(locale => verifyValidateLocale(locale, /*expctedToReadFile*/ false)); + ts.supportedLocaleDirectories.forEach(locale => verifyValidateLocale(locale, /*expectedToReadFile*/ true)); + ["en", "en-us"].forEach(locale => verifyValidateLocale(locale, /*expectedToReadFile*/ false)); +}); + +describe("unittests:: Public APIs :: forEachChild of @param comments in JSDoc", () => { + const content = ` +/** + * @param The {@link TypeReferencesInAedoc}. + */ +var x +`; + const sourceFile = ts.createSourceFile("/file.ts", content, ts.ScriptTarget.ESNext, /*setParentNodes*/ true); + const paramTag = sourceFile.getChildren()[0].getChildren()[0].getChildren()[0].getChildren()[0]; + const kids = paramTag.getChildren(); + const seen: Set = new Set(); + ts.forEachChild(paramTag, n => { + assert.strictEqual(/*actual*/ false, seen.has(n), "Found a duplicate-added child"); + seen.add(n); + }); + assert.equal(5, kids.length); });