better error message

This commit is contained in:
Arthur Ozga 2017-10-06 16:16:37 -07:00
parent 0afaadba3b
commit 932b1b038c
3 changed files with 4 additions and 17 deletions

View file

@ -20018,7 +20018,7 @@ namespace ts {
const augmentsTags = getAllJSDocTagsOfKind(classLike, SyntaxKind.JSDocAugmentsTag);
Debug.assert(augmentsTags.length > 0);
if (augmentsTags.length > 1) {
error(augmentsTags[1], Diagnostics.The_total_number_of_augments_and_extends_tags_allowed_for_a_single_class_declaration_is_at_most_1);
error(augmentsTags[1], Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag);
}
const name = getIdentifierFromEntityNameExpression(node.class.expression);

View file

@ -3527,7 +3527,7 @@
"category": "Error",
"code": 8024
},
"The total number of `@augments` and `@extends` tags allowed for a single class declaration is at most 1.": {
"Class declarations cannot have more than one `@augments` or `@extends` tag.": {
"category": "Error",
"code": 8025
},

View file

@ -10,6 +10,7 @@
//// */
//// class MyStringThing extends Thing {
//// constructor() {
//// super();
//// var x = this.mine;
//// x/**/;
//// }
@ -27,24 +28,10 @@ verify.quickInfoIs("(local var) x: number");
verify.getSemanticDiagnostics(
`[
{
"message": "The total number of \`@augments\` and \`@extends\` tags allowed for a single class declaration is at most 1.",
"message": "Class declarations cannot have more than one \`@augments\` or \`@extends\` tag.",
"start": 36,
"length": 24,
"category": "error",
"code": 8025
},
{
"message": "Constructors for derived classes must contain a \'super\' call.",
"start": 105,
"length": 59,
"category": "error",
"code": 2377
},
{
"message": "\'super\' must be called before accessing \'this\' in the constructor of a derived class.",
"start": 137,
"length": 4,
"category": "error",
"code": 17009
}
]`);