Skip to content

Commit 024b1fd

Browse files
author
Andy
authored
Make it a parse error for an @augments jsdoc tag to not include a type (#18745)
1 parent 0abfd6a commit 024b1fd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/compiler/parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6599,12 +6599,12 @@ namespace ts {
65996599
const result = <JSDocTypeTag>createNode(SyntaxKind.JSDocTypeTag, atToken.pos);
66006600
result.atToken = atToken;
66016601
result.tagName = tagName;
6602-
result.typeExpression = parseJSDocTypeExpression(/*mayBail*/ true);
6602+
result.typeExpression = parseJSDocTypeExpression(/*requireBraces*/ true);
66036603
return finishNode(result);
66046604
}
66056605

66066606
function parseAugmentsTag(atToken: AtToken, tagName: Identifier): JSDocAugmentsTag {
6607-
const typeExpression = tryParseTypeExpression();
6607+
const typeExpression = parseJSDocTypeExpression(/*requireBraces*/ true);
66086608

66096609
const result = <JSDocAugmentsTag>createNode(SyntaxKind.JSDocAugmentsTag, atToken.pos);
66106610
result.atToken = atToken;

src/harness/unittests/jsDocParsing.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ namespace ts {
144144
`/**
145145
* @type
146146
*/`);
147+
148+
parsesIncorrectly("@augments with no type",
149+
`/**
150+
* @augments
151+
*/`);
147152
});
148153

149154
describe("parsesCorrectly", () => {

0 commit comments

Comments
 (0)