From bd07cee9535a4ce39da23172c2d76184b41167ed Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 1 Nov 2014 07:38:46 -0700 Subject: [PATCH] Allow type aliases for object type literals --- src/compiler/diagnosticInformationMap.generated.ts | 1 - src/compiler/diagnosticMessages.json | 4 ---- src/compiler/parser.ts | 7 ------- 3 files changed, 12 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 82567f70ca6..b9485de89fd 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -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." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 72d7c79a024..d4be9b83313 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -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", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6c2207a08d2..429c4b8a4ed 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3760,13 +3760,6 @@ module ts { parseExpected(SyntaxKind.EqualsToken); node.type = parseType(); parseSemicolon(); - var n = node.type; - while (n.kind === SyntaxKind.ParenType) { - n = (n).type; - } - if (n.kind === SyntaxKind.TypeLiteral && (n.pos !== (n).members.pos || n.end !== (n).members.end)) { - grammarErrorOnNode(node.type, Diagnostics.Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead); - } return finishNode(node); }