report error for duplicate @type declaration (#38340)

This commit is contained in:
Wenqi
2020-05-12 03:47:49 +08:00
committed by GitHub
parent 738b6b5b68
commit 1b7b3eb0f7
6 changed files with 52 additions and 0 deletions

View File

@@ -4911,6 +4911,14 @@
"category": "Error",
"code": 8032
},
"A JSDoc '@typedef' comment may not contain multiple '@type' tags.": {
"category": "Error",
"code": 8033
},
"The tag was first specified here.": {
"category": "Error",
"code": 8034
},
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": {
"category": "Error",
"code": 9002

View File

@@ -7483,6 +7483,14 @@ namespace ts {
}
if (child.kind === SyntaxKind.JSDocTypeTag) {
if (childTypeTag) {
parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
const lastError = lastOrUndefined(parseDiagnostics);
if (lastError) {
addRelatedInfo(
lastError,
createDiagnosticForNode(sourceFile, Diagnostics.The_tag_was_first_specified_here)
);
}
break;
}
else {