Skip to content

Commit 075ee3d

Browse files
authored
refactor: follow microsoftgh-50257 JSX.IntrinsicClassAttributes logic (microsoft#50271)
1 parent 9189e42 commit 075ee3d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27614,16 +27614,15 @@ namespace ts {
2761427614
if (!isErrorType(intrinsicClassAttribs)) {
2761527615
const typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
2761627616
const hostClassType = getReturnTypeOfSignature(sig);
27617-
let libraryManagedAttributeType: Type | undefined;
27618-
if (typeParams && typeParams.length === 1) {
27617+
let libraryManagedAttributeType: Type;
27618+
if (typeParams) {
27619+
// apply JSX.IntrinsicClassElements<hostClassType, ...>
2761927620
const inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), isInJSFile(context));
2762027621
libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
2762127622
}
27622-
else if (typeParams) libraryManagedAttributeType = undefined;
27623+
// or JSX.IntrinsicClassElements has no generics.
2762327624
else libraryManagedAttributeType = intrinsicClassAttribs;
27624-
if (libraryManagedAttributeType) {
27625-
apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
27626-
}
27625+
apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
2762727626
}
2762827627

2762927628
const intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);

0 commit comments

Comments
 (0)