Allow type aliases for object type literals

This commit is contained in:
Anders Hejlsberg 2014-11-01 07:38:46 -07:00
parent 33cee0cd20
commit bd07cee953
3 changed files with 0 additions and 12 deletions

View file

@ -120,7 +120,6 @@ module ts {
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" },
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." },
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." },
Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead: { code: 1158, category: DiagnosticCategory.Error, key: "Aliased type cannot be an object type literal. Use an interface declaration instead." },
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." },

View file

@ -471,10 +471,6 @@
"category": "Error",
"code": 1157
},
"Aliased type cannot be an object type literal. Use an interface declaration instead.": {
"category": "Error",
"code": 1158
},
"Duplicate identifier '{0}'.": {
"category": "Error",

View file

@ -3760,13 +3760,6 @@ module ts {
parseExpected(SyntaxKind.EqualsToken);
node.type = parseType();
parseSemicolon();
var n = node.type;
while (n.kind === SyntaxKind.ParenType) {
n = (<ParenTypeNode>n).type;
}
if (n.kind === SyntaxKind.TypeLiteral && (n.pos !== (<TypeLiteralNode>n).members.pos || n.end !== (<TypeLiteralNode>n).members.end)) {
grammarErrorOnNode(node.type, Diagnostics.Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead);
}
return finishNode(node);
}