From a8ebdf0cbd12f34f28bd62a03cc77505ed9eac12 Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 13 Nov 2014 12:02:13 -0800 Subject: [PATCH] Address code review --- src/compiler/binder.ts | 2 +- src/compiler/checker.ts | 16 +++++---- .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- src/compiler/emitter.ts | 4 +-- src/compiler/parser.ts | 18 +++++----- src/compiler/types.ts | 6 ++-- src/services/services.ts | 14 ++++---- .../objectLiteralShorthandProperties.js | 2 +- .../objectLiteralShorthandProperties.types | 2 +- ...jectLiteralShorthandProperties2.errors.txt | 36 +++++++++---------- .../objectLiteralShorthandProperties3.js | 2 +- .../objectLiteralShorthandProperties3.types | 2 +- ...jectLiteralShorthandProperties4.errors.txt | 4 +-- ...jectLiteralShorthandPropertiesTargetES6.js | 2 +- ...jectTypesWithOptionalProperties.errors.txt | 4 +-- 16 files changed, 60 insertions(+), 58 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index fe00830ae51..6d0c4f3706e 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -350,7 +350,7 @@ module ts { break; case SyntaxKind.Property: case SyntaxKind.PropertyAssignment: - case SyntaxKind.ShortHandPropertyAssignment: + case SyntaxKind.ShorthandPropertyAssignment: bindDeclaration(node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false); break; case SyntaxKind.EnumMember: diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4ebcb925a7e..0bf17edbf19 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -94,6 +94,7 @@ module ts { getReturnTypeOfSignature: getReturnTypeOfSignature, getSymbolsInScope: getSymbolsInScope, getSymbolInfo: getSymbolInfo, + getValueSymbolInfo: getValueSymbolInfo, getTypeOfNode: getTypeOfNode, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, @@ -111,7 +112,6 @@ module ts { isUndefinedSymbol: symbol => symbol === undefinedSymbol, isArgumentsSymbol: symbol => symbol === argumentsSymbol, hasEarlyErrors: hasEarlyErrors, - resolveEntityNameForShortHandPropertyAssignment: resolveEntityNameForShortHandPropertyAssignment, }; var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); @@ -538,10 +538,6 @@ module ts { return symbol.flags & meaning ? symbol : resolveImport(symbol); } - function resolveEntityNameForShortHandPropertyAssignment(location: Node): Symbol { - return resolveEntityName(location, location, SymbolFlags.Value); - } - function isExternalModuleNameRelative(moduleName: string): boolean { // TypeScript 1.0 spec (April 2014): 11.2.1 // An external module name is "relative" if the first term is "." or "..". @@ -1672,8 +1668,8 @@ module ts { } // If it is a short-hand property assignment; Use the type of the identifier - if (declaration.kind === SyntaxKind.ShortHandPropertyAssignment) { - var type = checkIdentifier((declaration.name)); + if (declaration.kind === SyntaxKind.ShorthandPropertyAssignment) { + var type = checkIdentifier(declaration.name); return type } @@ -4986,6 +4982,7 @@ module ts { type = checkExpression(memberDecl.initializer, contextualMapper); } else { + Debug.assert(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment); type = checkExpression(memberDecl.name, contextualMapper); } var prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name); @@ -8647,6 +8644,11 @@ module ts { return undefined; } + function getValueSymbolInfo(node: Node): Symbol { + // Get symbol information as value + return resolveEntityName(node, node, SymbolFlags.Value); + } + function getTypeOfNode(node: Node): Type { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 19d5f0c5f6b..e9d5b5571e1 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -122,7 +122,7 @@ module ts { let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." }, Invalid_template_literal_expected: { code: 1158, category: DiagnosticCategory.Error, key: "Invalid template literal; expected '}'" }, 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." }, - A_object_member_cannot_be_declared_optional: { code: 1159, category: DiagnosticCategory.Error, key: "A object member cannot be declared optional." }, + A_object_member_cannot_be_declared_optional: { code: 1160, category: DiagnosticCategory.Error, key: "A object member cannot be declared optional." }, 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 52235a0848e..9a13299e4b5 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -482,7 +482,7 @@ "A object member cannot be declared optional.": { "category": "Error", - "code": 1159 + "code": 1160 }, "Duplicate identifier '{0}'.": { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 12e0c5cd037..5781875ac9b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -934,7 +934,7 @@ module ts { case SyntaxKind.VariableDeclaration: case SyntaxKind.Property: case SyntaxKind.PropertyAssignment: - case SyntaxKind.ShortHandPropertyAssignment: + case SyntaxKind.ShorthandPropertyAssignment: case SyntaxKind.EnumMember: case SyntaxKind.Method: case SyntaxKind.FunctionDeclaration: @@ -2287,7 +2287,7 @@ module ts { return emitObjectLiteral(node); case SyntaxKind.PropertyAssignment: return emitPropertyAssignment(node); - case SyntaxKind.ShortHandPropertyAssignment: + case SyntaxKind.ShorthandPropertyAssignment: return emitShortHandPropertyAssignment(node); case SyntaxKind.PropertyAccess: return emitPropertyAccess(node); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2657fc83668..2fe3b8aa670 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -198,7 +198,7 @@ module ts { child((node).initializer); case SyntaxKind.Property: case SyntaxKind.PropertyAssignment: - case SyntaxKind.ShortHandPropertyAssignment: + case SyntaxKind.ShorthandPropertyAssignment: return child((node).name) || child((node).type) || child((node).initializer); @@ -574,7 +574,7 @@ module ts { case SyntaxKind.VariableDeclaration: case SyntaxKind.Property: case SyntaxKind.PropertyAssignment: - case SyntaxKind.ShortHandPropertyAssignment: + case SyntaxKind.ShorthandPropertyAssignment: case SyntaxKind.EnumMember: case SyntaxKind.Method: case SyntaxKind.FunctionDeclaration: @@ -2669,11 +2669,11 @@ module ts { return finishNode(node); } - function parsePropertyAssignment(): PropertyDeclaration { + function parsePropertyAssignment(): Declaration { var nodePos = scanner.getStartPos(); var nameToken = token; var propertyName = parsePropertyName(); - var node: PropertyDeclaration; + var node: Declaration; if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { node = createNode(SyntaxKind.PropertyAssignment, nodePos); node.name = propertyName; @@ -2684,25 +2684,25 @@ module ts { // var x = 1; // var y = { x() { } } // otherwise this will bring y.x into the scope of x which is incorrect - node.initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, undefined, sig, body); + (node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, undefined, sig, body); return finishNode(node); } if (token === SyntaxKind.QuestionToken) { var questionStart = scanner.getTokenPos(); - errorAtPos(questionStart, scanner.getStartPos() - questionStart, Diagnostics.A_object_member_cannot_be_declared_optional); + grammarErrorAtPos(questionStart, scanner.getStartPos() - questionStart, Diagnostics.A_object_member_cannot_be_declared_optional); nextToken(); } // Parse to check if it is short-hand property assignment or normal property assignment if (token !== SyntaxKind.ColonToken && nameToken === SyntaxKind.Identifier) { - node = createNode(SyntaxKind.ShortHandPropertyAssignment, nodePos); + node = createNode(SyntaxKind.ShorthandPropertyAssignment, nodePos); node.name = propertyName; } else { node = createNode(SyntaxKind.PropertyAssignment, nodePos); node.name = propertyName; parseExpected(SyntaxKind.ColonToken); - node.initializer = parseAssignmentExpression(false); + (node).initializer = parseAssignmentExpression(false); } return finishNode(node); } @@ -2752,7 +2752,7 @@ module ts { if (p.kind === SyntaxKind.PropertyAssignment) { currentKind = Property; } - else if (p.kind === SyntaxKind.ShortHandPropertyAssignment) { + else if (p.kind === SyntaxKind.ShorthandPropertyAssignment) { currentKind = Property; } else if (p.kind === SyntaxKind.GetAccessor) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8e392de8ff5..f2690a82462 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -165,7 +165,7 @@ module ts { ArrayLiteral, ObjectLiteral, PropertyAssignment, - ShortHandPropertyAssignment, + ShorthandPropertyAssignment, PropertyAccess, IndexedAccess, CallExpression, @@ -330,7 +330,7 @@ module ts { initializer?: Expression; } - export interface ShortHandPropertyDeclaration extends PropertyDeclaration { + export interface ShortHandPropertyDeclaration extends Declaration { name: Identifier; } @@ -715,6 +715,7 @@ module ts { getReturnTypeOfSignature(signature: Signature): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolInfo(node: Node): Symbol; + getValueSymbolInfo(node: Node): Symbol; getTypeOfNode(node: Node): Type; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; @@ -733,7 +734,6 @@ module ts { getEnumMemberValue(node: EnumMember): number; isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; - resolveEntityNameForShortHandPropertyAssignment(location: Node): Symbol; } export interface SymbolDisplayBuilder { diff --git a/src/services/services.ts b/src/services/services.ts index 43b9e96b2ca..822795a1c15 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1969,7 +1969,7 @@ module ts { /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node: Node): boolean { return (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NumericLiteral) && - (node.parent.kind === SyntaxKind.PropertyAssignment || node.parent.kind === SyntaxKind.ShortHandPropertyAssignment) && (node.parent).name === node; + (node.parent.kind === SyntaxKind.PropertyAssignment || node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) && (node.parent).name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node: Node): boolean { @@ -2648,7 +2648,7 @@ module ts { var existingMemberNames: Map = {}; forEach(existingMembers, m => { - if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShortHandPropertyAssignment) { + if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment) { // Ignore omitted expressions for missing members in the object literal return; } @@ -4062,9 +4062,9 @@ module ts { result.push(getReferenceEntryFromNode(referenceLocation)); } // TODO (yuisu): Comment - else if (referenceSymbol && referenceSymbol.declarations[0].kind === SyntaxKind.ShortHandPropertyAssignment) { + else if (referenceSymbol && referenceSymbol.declarations[0].kind === SyntaxKind.ShorthandPropertyAssignment) { var referenceSymbolDeclName = referenceSymbol.declarations[0].name; - if (searchSymbols.indexOf(typeInfoResolver.resolveEntityNameForShortHandPropertyAssignment(referenceSymbolDeclName)) >= 0 && + if (searchSymbols.indexOf(typeInfoResolver.getValueSymbolInfo(referenceSymbolDeclName)) >= 0 && !(referenceSymbol).target) { result.push(getReferenceEntryFromNode(referenceSymbolDeclName)); } @@ -4237,8 +4237,8 @@ module ts { }); // Add the symbol in the case of short-hand property assignment - if (location.kind === SyntaxKind.Identifier && location.parent.kind === SyntaxKind.ShortHandPropertyAssignment) { - result.push(typeInfoResolver.resolveEntityNameForShortHandPropertyAssignment(location)); + if (location.kind === SyntaxKind.Identifier && location.parent.kind === SyntaxKind.ShorthandPropertyAssignment) { + result.push(typeInfoResolver.getValueSymbolInfo(location)); } } @@ -4582,7 +4582,7 @@ module ts { case SyntaxKind.VariableDeclaration: case SyntaxKind.Property: case SyntaxKind.PropertyAssignment: - case SyntaxKind.ShortHandPropertyAssignment: + case SyntaxKind.ShorthandPropertyAssignment: case SyntaxKind.EnumMember: case SyntaxKind.Method: case SyntaxKind.Constructor: diff --git a/tests/baselines/reference/objectLiteralShorthandProperties.js b/tests/baselines/reference/objectLiteralShorthandProperties.js index 31e9eabb0a9..776b2bbe454 100644 --- a/tests/baselines/reference/objectLiteralShorthandProperties.js +++ b/tests/baselines/reference/objectLiteralShorthandProperties.js @@ -26,7 +26,7 @@ var x1 = { a: a }; var x2 = { - a: a + a: a, }; var x3 = { a: 0, diff --git a/tests/baselines/reference/objectLiteralShorthandProperties.types b/tests/baselines/reference/objectLiteralShorthandProperties.types index 2f4e17be239..f28f25e815c 100644 --- a/tests/baselines/reference/objectLiteralShorthandProperties.types +++ b/tests/baselines/reference/objectLiteralShorthandProperties.types @@ -1,4 +1,4 @@ -=== tests/cases/compiler/objectLiteralShorthandProperties.ts === +=== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties.ts === var a, b, c; >a : any >b : any diff --git a/tests/baselines/reference/objectLiteralShorthandProperties2.errors.txt b/tests/baselines/reference/objectLiteralShorthandProperties2.errors.txt index 814bbf18422..0e6b9eba616 100644 --- a/tests/baselines/reference/objectLiteralShorthandProperties2.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandProperties2.errors.txt @@ -1,23 +1,23 @@ -tests/cases/compiler/objectLiteralShorthandProperties2.ts(3,20): error TS1005: ':' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(4,7): error TS1005: ':' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(5,10): error TS1005: '(' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(6,10): error TS1005: '(' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(7,9): error TS1005: ':' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(8,10): error TS1005: ':' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(9,8): error TS1005: ':' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(10,10): error TS1005: ':' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(12,1): error TS1005: ':' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(15,6): error TS1005: ',' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(16,6): error TS1005: ',' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(17,6): error TS1005: '=' expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(18,1): error TS1128: Declaration or statement expected. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(15,5): error TS2300: Duplicate identifier 'a'. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(15,7): error TS2304: Cannot find name 'b'. -tests/cases/compiler/objectLiteralShorthandProperties2.ts(16,5): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(3,20): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(4,7): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(5,10): error TS1005: '(' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(6,10): error TS1005: '(' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(7,9): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(8,10): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(9,8): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(10,10): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(12,1): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(15,6): error TS1005: ',' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(16,6): error TS1005: ',' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(17,6): error TS1005: '=' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(18,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(15,5): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(15,7): error TS2304: Cannot find name 'b'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts(16,5): error TS2300: Duplicate identifier 'a'. -==== tests/cases/compiler/objectLiteralShorthandProperties2.ts (17 errors) ==== +==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties2.ts (17 errors) ==== // errors var y = { "stringLiteral", diff --git a/tests/baselines/reference/objectLiteralShorthandProperties3.js b/tests/baselines/reference/objectLiteralShorthandProperties3.js index b3e567bebc8..0d436efa787 100644 --- a/tests/baselines/reference/objectLiteralShorthandProperties3.js +++ b/tests/baselines/reference/objectLiteralShorthandProperties3.js @@ -25,6 +25,6 @@ var m; var z = m.x; var y = { a: m.x, - m.x: m.x + x: m.x }; })(m || (m = {})); diff --git a/tests/baselines/reference/objectLiteralShorthandProperties3.types b/tests/baselines/reference/objectLiteralShorthandProperties3.types index 0ca744aaf88..5d58532b3d1 100644 --- a/tests/baselines/reference/objectLiteralShorthandProperties3.types +++ b/tests/baselines/reference/objectLiteralShorthandProperties3.types @@ -1,4 +1,4 @@ -=== tests/cases/compiler/objectLiteralShorthandProperties3.ts === +=== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties3.ts === // module export module m { diff --git a/tests/baselines/reference/objectLiteralShorthandProperties4.errors.txt b/tests/baselines/reference/objectLiteralShorthandProperties4.errors.txt index 0928d8f2d94..678e18143e9 100644 --- a/tests/baselines/reference/objectLiteralShorthandProperties4.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandProperties4.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/objectLiteralShorthandProperties4.ts(3,5): error TS2304: Cannot find name 'undefinedVariable'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties4.ts(3,5): error TS2304: Cannot find name 'undefinedVariable'. -==== tests/cases/compiler/objectLiteralShorthandProperties4.ts (1 errors) ==== +==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandProperties4.ts (1 errors) ==== var x = { x, // OK undefinedVariable // Error diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesTargetES6.js b/tests/baselines/reference/objectLiteralShorthandPropertiesTargetES6.js index c02911c4993..a35fc697706 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesTargetES6.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesTargetES6.js @@ -57,6 +57,6 @@ var m; var z = m.x; var y = { a: m.x, - m.x + x: m.x }; })(m || (m = {})); diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt index 35593f4378f..e73e8adc930 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(12,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(20,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1159: A object member cannot be declared optional. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1160: A object member cannot be declared optional. ==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (3 errors) ==== @@ -33,5 +33,5 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith var b = { x?: 1 // error -!!! error TS1159: A object member cannot be declared optional. +!!! error TS1160: A object member cannot be declared optional. } \ No newline at end of file