From 2dd4c8af07342e14d4061a68732755900a674813 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 15 May 2017 16:17:10 -0700 Subject: [PATCH] Update LKG --- lib/tsc.js | 17 ++++++++++++++--- lib/tsserver.js | 17 ++++++++++++++--- lib/tsserverlibrary.js | 17 ++++++++++++++--- lib/typescript.js | 17 ++++++++++++++--- lib/typescriptServices.js | 17 ++++++++++++++--- 5 files changed, 70 insertions(+), 15 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 24996035318..db2b1bb1fcc 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -31272,6 +31272,7 @@ var ts; var spread = emptyObjectType; var attributesArray = []; var hasSpreadAnyType = false; + var typeToIntersect; var explicitlySpecifyChildrenAttribute = false; var jsxChildrenPropertyName = getJsxElementChildrenPropertyname(); for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { @@ -31302,11 +31303,16 @@ var ts; attributesArray = []; attributesTable = ts.createMap(); } - var exprType = getApparentType(checkExpression(attributeDecl.expression)); + var exprType = checkExpression(attributeDecl.expression); if (isTypeAny(exprType)) { hasSpreadAnyType = true; } - spread = getSpreadType(spread, exprType); + if (isValidSpreadType(exprType)) { + spread = getSpreadType(spread, exprType); + } + else { + typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType; + } } } if (!hasSpreadAnyType) { @@ -31352,7 +31358,12 @@ var ts; attributesTable.set(jsxChildrenPropertyName, childrenPropSymbol); } } - return hasSpreadAnyType ? anyType : createJsxAttributesType(attributes.symbol, attributesTable); + if (hasSpreadAnyType) { + return anyType; + } + var attributeType = createJsxAttributesType(attributes.symbol, attributesTable); + return typeToIntersect && attributesTable.size ? getIntersectionType([typeToIntersect, attributeType]) : + typeToIntersect ? typeToIntersect : attributeType; function createJsxAttributesType(symbol, attributesTable) { var result = createAnonymousType(symbol, attributesTable, emptyArray, emptyArray, undefined, undefined); result.flags |= 33554432 | 4194304; diff --git a/lib/tsserver.js b/lib/tsserver.js index 6d248f67609..f3b7b1a8a12 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -32436,6 +32436,7 @@ var ts; var spread = emptyObjectType; var attributesArray = []; var hasSpreadAnyType = false; + var typeToIntersect; var explicitlySpecifyChildrenAttribute = false; var jsxChildrenPropertyName = getJsxElementChildrenPropertyname(); for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { @@ -32466,11 +32467,16 @@ var ts; attributesArray = []; attributesTable = ts.createMap(); } - var exprType = getApparentType(checkExpression(attributeDecl.expression)); + var exprType = checkExpression(attributeDecl.expression); if (isTypeAny(exprType)) { hasSpreadAnyType = true; } - spread = getSpreadType(spread, exprType); + if (isValidSpreadType(exprType)) { + spread = getSpreadType(spread, exprType); + } + else { + typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType; + } } } if (!hasSpreadAnyType) { @@ -32516,7 +32522,12 @@ var ts; attributesTable.set(jsxChildrenPropertyName, childrenPropSymbol); } } - return hasSpreadAnyType ? anyType : createJsxAttributesType(attributes.symbol, attributesTable); + if (hasSpreadAnyType) { + return anyType; + } + var attributeType = createJsxAttributesType(attributes.symbol, attributesTable); + return typeToIntersect && attributesTable.size ? getIntersectionType([typeToIntersect, attributeType]) : + typeToIntersect ? typeToIntersect : attributeType; function createJsxAttributesType(symbol, attributesTable) { var result = createAnonymousType(symbol, attributesTable, emptyArray, emptyArray, undefined, undefined); result.flags |= 33554432 | 4194304; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 5749d76e1fb..3bad62b6ad0 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -33782,6 +33782,7 @@ var ts; var spread = emptyObjectType; var attributesArray = []; var hasSpreadAnyType = false; + var typeToIntersect; var explicitlySpecifyChildrenAttribute = false; var jsxChildrenPropertyName = getJsxElementChildrenPropertyname(); for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { @@ -33812,11 +33813,16 @@ var ts; attributesArray = []; attributesTable = ts.createMap(); } - var exprType = getApparentType(checkExpression(attributeDecl.expression)); + var exprType = checkExpression(attributeDecl.expression); if (isTypeAny(exprType)) { hasSpreadAnyType = true; } - spread = getSpreadType(spread, exprType); + if (isValidSpreadType(exprType)) { + spread = getSpreadType(spread, exprType); + } + else { + typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType; + } } } if (!hasSpreadAnyType) { @@ -33862,7 +33868,12 @@ var ts; attributesTable.set(jsxChildrenPropertyName, childrenPropSymbol); } } - return hasSpreadAnyType ? anyType : createJsxAttributesType(attributes.symbol, attributesTable); + if (hasSpreadAnyType) { + return anyType; + } + var attributeType = createJsxAttributesType(attributes.symbol, attributesTable); + return typeToIntersect && attributesTable.size ? getIntersectionType([typeToIntersect, attributeType]) : + typeToIntersect ? typeToIntersect : attributeType; function createJsxAttributesType(symbol, attributesTable) { var result = createAnonymousType(symbol, attributesTable, emptyArray, emptyArray, undefined, undefined); result.flags |= 33554432 | 4194304; diff --git a/lib/typescript.js b/lib/typescript.js index 1117c5233f2..cc33376d194 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -37595,6 +37595,7 @@ var ts; var spread = emptyObjectType; var attributesArray = []; var hasSpreadAnyType = false; + var typeToIntersect; var explicitlySpecifyChildrenAttribute = false; var jsxChildrenPropertyName = getJsxElementChildrenPropertyname(); for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { @@ -37625,11 +37626,16 @@ var ts; attributesArray = []; attributesTable = ts.createMap(); } - var exprType = getApparentType(checkExpression(attributeDecl.expression)); + var exprType = checkExpression(attributeDecl.expression); if (isTypeAny(exprType)) { hasSpreadAnyType = true; } - spread = getSpreadType(spread, exprType); + if (isValidSpreadType(exprType)) { + spread = getSpreadType(spread, exprType); + } + else { + typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType; + } } } if (!hasSpreadAnyType) { @@ -37683,7 +37689,12 @@ var ts; attributesTable.set(jsxChildrenPropertyName, childrenPropSymbol); } } - return hasSpreadAnyType ? anyType : createJsxAttributesType(attributes.symbol, attributesTable); + if (hasSpreadAnyType) { + return anyType; + } + var attributeType = createJsxAttributesType(attributes.symbol, attributesTable); + return typeToIntersect && attributesTable.size ? getIntersectionType([typeToIntersect, attributeType]) : + typeToIntersect ? typeToIntersect : attributeType; /** * Create anonymous type from given attributes symbol table. * @param symbol a symbol of JsxAttributes containing attributes corresponding to attributesTable diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 1117c5233f2..cc33376d194 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -37595,6 +37595,7 @@ var ts; var spread = emptyObjectType; var attributesArray = []; var hasSpreadAnyType = false; + var typeToIntersect; var explicitlySpecifyChildrenAttribute = false; var jsxChildrenPropertyName = getJsxElementChildrenPropertyname(); for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { @@ -37625,11 +37626,16 @@ var ts; attributesArray = []; attributesTable = ts.createMap(); } - var exprType = getApparentType(checkExpression(attributeDecl.expression)); + var exprType = checkExpression(attributeDecl.expression); if (isTypeAny(exprType)) { hasSpreadAnyType = true; } - spread = getSpreadType(spread, exprType); + if (isValidSpreadType(exprType)) { + spread = getSpreadType(spread, exprType); + } + else { + typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType; + } } } if (!hasSpreadAnyType) { @@ -37683,7 +37689,12 @@ var ts; attributesTable.set(jsxChildrenPropertyName, childrenPropSymbol); } } - return hasSpreadAnyType ? anyType : createJsxAttributesType(attributes.symbol, attributesTable); + if (hasSpreadAnyType) { + return anyType; + } + var attributeType = createJsxAttributesType(attributes.symbol, attributesTable); + return typeToIntersect && attributesTable.size ? getIntersectionType([typeToIntersect, attributeType]) : + typeToIntersect ? typeToIntersect : attributeType; /** * Create anonymous type from given attributes symbol table. * @param symbol a symbol of JsxAttributes containing attributes corresponding to attributesTable