@@ -13548,6 +13548,17 @@ namespace ts {
13548
13548
return _jsxElementChildrenPropertyName;
13549
13549
}
13550
13550
13551
+ function createIntersectionOfApparentTypeOfJsxPropsType(propsType: Type): Type {
13552
+ if (propsType && propsType.flags & TypeFlags.Intersection) {
13553
+ const propsApprentType: Type[] = [];
13554
+ for (const t of (<UnionOrIntersectionType>propsType).types) {
13555
+ propsApprentType.push(getApparentType(t));
13556
+ }
13557
+ return getIntersectionType(propsApprentType);
13558
+ }
13559
+ return propsType;
13560
+ }
13561
+
13551
13562
/**
13552
13563
* Get JSX attributes type by trying to resolve openingLikeElement as a stateless function component.
13553
13564
* Return only attributes type of successfully resolved call signature.
@@ -13568,6 +13579,7 @@ namespace ts {
13568
13579
if (callSignature !== unknownSignature) {
13569
13580
const callReturnType = callSignature && getReturnTypeOfSignature(callSignature);
13570
13581
let paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0]));
13582
+ paramType = createIntersectionOfApparentTypeOfJsxPropsType(paramType);
13571
13583
if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) {
13572
13584
// Intersect in JSX.IntrinsicAttributes if it exists
13573
13585
const intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes);
@@ -13605,7 +13617,8 @@ namespace ts {
13605
13617
let allMatchingAttributesType: Type;
13606
13618
for (const candidate of candidatesOutArray) {
13607
13619
const callReturnType = getReturnTypeOfSignature(candidate);
13608
- const paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0]));
13620
+ let paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0]));
13621
+ paramType = createIntersectionOfApparentTypeOfJsxPropsType(paramType);
13609
13622
if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) {
13610
13623
let shouldBeCandidate = true;
13611
13624
for (const attribute of openingLikeElement.attributes.properties) {
0 commit comments