diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7048677e8a4..22bc8763008 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -6639,12 +6639,16 @@ namespace ts { return true; case "prop": case "property": - if (!parentTag.jsDocPropertyTags) { - parentTag.jsDocPropertyTags = >[]; - } const propertyTag = parsePropertyTag(atToken, tagName); - parentTag.jsDocPropertyTags.push(propertyTag); - return true; + if (propertyTag) { + if (!parentTag.jsDocPropertyTags) { + parentTag.jsDocPropertyTags = >[]; + } + parentTag.jsDocPropertyTags.push(propertyTag); + return true; + } + // Error parsing property tag + return false; } return false; } diff --git a/tests/cases/fourslash/incorrectJsDocObjectLiteralType.ts b/tests/cases/fourslash/incorrectJsDocObjectLiteralType.ts new file mode 100644 index 00000000000..ddf65ec0e8a --- /dev/null +++ b/tests/cases/fourslash/incorrectJsDocObjectLiteralType.ts @@ -0,0 +1,8 @@ +/// + +//// /**/ + +goTo.marker(); +verify.navigationItemsListCount(0, "foo", "exact"); +edit.insert("/**\n * @typedef {Object} foo\n * @property {any} [obj]\n */\nexport default function foo() {\n}"); +verify.navigationItemsListContains("foo", "function", "foo", "exact");