@@ -3030,7 +3030,7 @@ namespace ts {
30303030 }
30313031
30323032 function isComputedNonLiteralName(name: PropertyName): boolean {
3033- return name.kind === SyntaxKind.ComputedPropertyName && !isStringOrNumericLiteral((<ComputedPropertyName>name).expression.kind );
3033+ return name.kind === SyntaxKind.ComputedPropertyName && !isStringOrNumericLiteral((<ComputedPropertyName>name).expression);
30343034 }
30353035
30363036 function getRestType(source: Type, properties: PropertyName[], symbol: Symbol): Type {
@@ -8907,7 +8907,7 @@ namespace ts {
89078907 return type;
89088908 }
89098909
8910- function getTypeOfDestructuredProperty(type: Type, name: Identifier | LiteralExpression | ComputedPropertyName ) {
8910+ function getTypeOfDestructuredProperty(type: Type, name: PropertyName ) {
89118911 const text = getTextOfPropertyName(name);
89128912 return getTypeOfPropertyOfType(type, text) ||
89138913 isNumericLiteralName(text) && getIndexTypeOfType(type, IndexKind.Number) ||
@@ -9936,8 +9936,7 @@ namespace ts {
99369936 // Due to the emit for class decorators, any reference to the class from inside of the class body
99379937 // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
99389938 // behavior of class names in ES6.
9939- if (languageVersion === ScriptTarget.ES2015
9940- && declaration.kind === SyntaxKind.ClassDeclaration
9939+ if (declaration.kind === SyntaxKind.ClassDeclaration
99419940 && nodeIsDecorated(declaration)) {
99429941 let container = getContainingClass(node);
99439942 while (container !== undefined) {
@@ -11165,10 +11164,10 @@ namespace ts {
1116511164 return links.resolvedType;
1116611165 }
1116711166
11168- function getObjectLiteralIndexInfo(node: ObjectLiteralExpression , properties: Symbol[], kind: IndexKind): IndexInfo {
11167+ function getObjectLiteralIndexInfo(propertyNodes: NodeArray<ObjectLiteralElementLike>, offset: number , properties: Symbol[], kind: IndexKind): IndexInfo {
1116911168 const propTypes: Type[] = [];
1117011169 for (let i = 0; i < properties.length; i++) {
11171- if (kind === IndexKind.String || isNumericName(node.properties[i ].name)) {
11170+ if (kind === IndexKind.String || isNumericName(propertyNodes[i + offset ].name)) {
1117211171 propTypes.push(getTypeOfSymbol(properties[i]));
1117311172 }
1117411173 }
@@ -11194,7 +11193,9 @@ namespace ts {
1119411193 let hasComputedStringProperty = false;
1119511194 let hasComputedNumberProperty = false;
1119611195
11197- for (const memberDecl of node.properties) {
11196+ let offset = 0;
11197+ for (let i = 0; i < node.properties.length; i++) {
11198+ const memberDecl = node.properties[i];
1119811199 let member = memberDecl.symbol;
1119911200 if (memberDecl.kind === SyntaxKind.PropertyAssignment ||
1120011201 memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment ||
@@ -11263,6 +11264,7 @@ namespace ts {
1126311264 return unknownType;
1126411265 }
1126511266 spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false);
11267+ offset = i + 1;
1126611268 continue;
1126711269 }
1126811270 else {
@@ -11316,8 +11318,8 @@ namespace ts {
1131611318 return createObjectLiteralType();
1131711319
1131811320 function createObjectLiteralType() {
11319- const stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.String) : undefined;
11320- const numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.Number) : undefined;
11321+ const stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset , propertiesArray, IndexKind.String) : undefined;
11322+ const numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset , propertiesArray, IndexKind.Number) : undefined;
1132111323 const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
1132211324 const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshLiteral;
1132311325 result.flags |= TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags);
@@ -14501,6 +14503,8 @@ namespace ts {
1450114503 case SyntaxKind.LessThanEqualsToken:
1450214504 case SyntaxKind.GreaterThanEqualsToken:
1450314505 if (checkForDisallowedESSymbolOperand(operator)) {
14506+ leftType = getBaseTypeOfLiteralType(leftType);
14507+ rightType = getBaseTypeOfLiteralType(rightType);
1450414508 if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
1450514509 reportOperatorError();
1450614510 }
0 commit comments