@@ -12241,10 +12241,12 @@ namespace ts {
1224112241
1224212242 /**
1224312243 * Get attributes type of the JSX opening-like element. The result is from resolving "attributes" property of the opening-like element.
12244- *
12244+ *
1224512245 * @param openingLikeElement a JSX opening-like element
1224612246 * @param filter a function to remove attributes that will not participate in checking whether attributes are assignable
1224712247 * @return an anonymous type (similar to the one returned by checkObjectLiteral) in which its properties are attributes property.
12248+ * @remarks Because this function calls getSpreadType, it needs to use the same checks as checkObjectLiteral,
12249+ * which also calls getSpreadType.
1224812250 */
1224912251 function createJsxAttributesTypeFromAttributesProperty(openingLikeElement: JsxOpeningLikeElement, filter?: (symbol: Symbol) => boolean, contextualMapper?: TypeMapper) {
1225012252 const attributes = openingLikeElement.attributes;
@@ -12256,7 +12258,7 @@ namespace ts {
1225612258 if (isJsxAttribute(attributeDecl)) {
1225712259 const exprType = attributeDecl.initializer ?
1225812260 checkExpression(attributeDecl.initializer, contextualMapper) :
12259- trueType; // <Elem attr /> is sugar for <Elem attr={true} />
12261+ trueType; // <Elem attr /> is sugar for <Elem attr={true} />
1226012262
1226112263 const attributeSymbol = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name);
1226212264 attributeSymbol.declarations = member.declarations;
@@ -12277,7 +12279,7 @@ namespace ts {
1227712279 attributesTable = createMap<Symbol>();
1227812280 }
1227912281 const exprType = checkExpression(attributeDecl.expression);
12280- if (!(exprType.flags & (TypeFlags.Object | TypeFlags.Any) )) {
12282+ if (!isValidSpreadType (exprType)) {
1228112283 error(attributeDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types);
1228212284 return anyType;
1228312285 }
0 commit comments