mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Update error codes
This commit is contained in:
@@ -124,14 +124,14 @@ module ts {
|
||||
Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." },
|
||||
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
|
||||
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
|
||||
An_object_member_cannot_be_declared_optional: { code: 1160, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
|
||||
Computed_property_names_are_not_allowed_in_interfaces_or_type_literals: { code: 1161, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces or type literals." },
|
||||
Computed_property_names_are_not_allowed_in_enums: { code: 1162, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
|
||||
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
|
||||
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." },
|
||||
Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1163, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." },
|
||||
Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." },
|
||||
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." },
|
||||
Computed_property_names_are_not_allowed_in_method_overloads: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." },
|
||||
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
|
||||
Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." },
|
||||
Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." },
|
||||
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." },
|
||||
Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." },
|
||||
Computed_property_names_are_not_allowed_in_interfaces_or_type_literals: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces or type literals." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
|
||||
@@ -488,14 +488,6 @@
|
||||
"code": 1161
|
||||
},
|
||||
"An object member cannot be declared optional.": {
|
||||
"category": "Error",
|
||||
"code": 1160
|
||||
},
|
||||
"Computed property names are not allowed in interfaces or type literals.": {
|
||||
"category": "Error",
|
||||
"code": 1161
|
||||
},
|
||||
"Computed property names are not allowed in enums.": {
|
||||
"category": "Error",
|
||||
"code": 1162
|
||||
},
|
||||
@@ -503,22 +495,30 @@
|
||||
"category": "Error",
|
||||
"code": 1163
|
||||
},
|
||||
"Computed property names are not allowed in an ambient context.": {
|
||||
"category": "Error",
|
||||
"code": 1163
|
||||
},
|
||||
"Computed property names are not allowed in class property declarations.": {
|
||||
"Computed property names are not allowed in enums.": {
|
||||
"category": "Error",
|
||||
"code": 1164
|
||||
},
|
||||
"Computed property names are only available when targeting ECMAScript 6 and higher.": {
|
||||
"Computed property names are not allowed in an ambient context.": {
|
||||
"category": "Error",
|
||||
"code": 1165
|
||||
},
|
||||
"Computed property names are not allowed in method overloads.": {
|
||||
"Computed property names are not allowed in class property declarations.": {
|
||||
"category": "Error",
|
||||
"code": 1166
|
||||
},
|
||||
"Computed property names are only available when targeting ECMAScript 6 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1167
|
||||
},
|
||||
"Computed property names are not allowed in method overloads.": {
|
||||
"category": "Error",
|
||||
"code": 1168
|
||||
},
|
||||
"Computed property names are not allowed in interfaces or type literals.": {
|
||||
"category": "Error",
|
||||
"code": 1169
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
|
||||
@@ -4477,7 +4477,12 @@ module ts {
|
||||
// However, property declarations disallow computed names in general,
|
||||
// and accessors are not allowed in ambient contexts in general,
|
||||
// so this error only really matters for methods.
|
||||
return inAmbientContext && checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context);
|
||||
if (inAmbientContext) {
|
||||
return checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context);
|
||||
}
|
||||
else if (!node.body) {
|
||||
return checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads);
|
||||
}
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
return checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces_or_type_literals);
|
||||
|
||||
Reference in New Issue
Block a user