Skip to content

Commit f15d87b

Browse files
committed
Merge pull request #1032 from Microsoft/checkTypeAliasName
Type alias cannot have reserved type name (#1030)
2 parents 10681c7 + 538e7ea commit f15d87b

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/compiler/checker.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7697,6 +7697,7 @@ module ts {
76977697
}
76987698

76997699
function checkTypeAliasDeclaration(node: TypeAliasDeclaration) {
7700+
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
77007701
checkSourceElement(node.type);
77017702
}
77027703

src/compiler/diagnosticInformationMap.generated.ts

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ module ts {
269269
The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: DiagnosticCategory.Error, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." },
270270
Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: DiagnosticCategory.Error, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." },
271271
Type_alias_0_circularly_references_itself: { code: 2456, category: DiagnosticCategory.Error, key: "Type alias '{0}' circularly references itself." },
272+
Type_alias_name_cannot_be_0: { code: 2457, category: DiagnosticCategory.Error, key: "Type alias name cannot be '{0}'" },
272273
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
273274
Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
274275
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },

src/compiler/diagnosticMessages.json

+4
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,10 @@
10761076
"category": "Error",
10771077
"code": 2456
10781078
},
1079+
"Type alias name cannot be '{0}'": {
1080+
"category": "Error",
1081+
"code": 2457
1082+
},
10791083

10801084
"Import declaration '{0}' is using private name '{1}'.": {
10811085
"category": "Error",

0 commit comments

Comments
 (0)