@@ -13467,6 +13467,17 @@ namespace ts {
13467
13467
return _jsxElementChildrenPropertyName;
13468
13468
}
13469
13469
13470
+ function createIntersectionOfApparentTypeOfJsxPropsType(propsType: Type): Type {
13471
+ if (propsType && propsType.flags & TypeFlags.Intersection) {
13472
+ const propsApprentType: Type[] = [];
13473
+ for (const t of (<UnionOrIntersectionType>propsType).types) {
13474
+ propsApprentType.push(getApparentType(t));
13475
+ }
13476
+ return getIntersectionType(propsApprentType);
13477
+ }
13478
+ return propsType;
13479
+ }
13480
+
13470
13481
/**
13471
13482
* Get JSX attributes type by trying to resolve openingLikeElement as a stateless function component.
13472
13483
* Return only attributes type of successfully resolved call signature.
@@ -13487,6 +13498,7 @@ namespace ts {
13487
13498
if (callSignature !== unknownSignature) {
13488
13499
const callReturnType = callSignature && getReturnTypeOfSignature(callSignature);
13489
13500
let paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0]));
13501
+ paramType = createIntersectionOfApparentTypeOfJsxPropsType(paramType);
13490
13502
if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) {
13491
13503
// Intersect in JSX.IntrinsicAttributes if it exists
13492
13504
const intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes);
@@ -13524,7 +13536,8 @@ namespace ts {
13524
13536
let allMatchingAttributesType: Type;
13525
13537
for (const candidate of candidatesOutArray) {
13526
13538
const callReturnType = getReturnTypeOfSignature(candidate);
13527
- const paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0]));
13539
+ let paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0]));
13540
+ paramType = createIntersectionOfApparentTypeOfJsxPropsType(paramType);
13528
13541
if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) {
13529
13542
let shouldBeCandidate = true;
13530
13543
for (const attribute of openingLikeElement.attributes.properties) {
0 commit comments