mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 15:25:54 -06:00
getApparentType of the propsType
This commit is contained in:
parent
705771d874
commit
84f419b533
@ -13548,13 +13548,16 @@ namespace ts {
|
||||
return _jsxElementChildrenPropertyName;
|
||||
}
|
||||
|
||||
function createIntersectionOfApparentTypeOfJsxPropsType(propsType: Type): Type {
|
||||
if (propsType && propsType.flags & TypeFlags.Intersection) {
|
||||
const propsApprentType: Type[] = [];
|
||||
for (const t of (<UnionOrIntersectionType>propsType).types) {
|
||||
propsApprentType.push(getApparentType(t));
|
||||
function getApparentTypeOfJsxPropsType(propsType: Type): Type {
|
||||
if (propsType) {
|
||||
if (propsType.flags & TypeFlags.Intersection) {
|
||||
const propsApprentType: Type[] = [];
|
||||
for (const t of (<UnionOrIntersectionType>propsType).types) {
|
||||
propsApprentType.push(getApparentType(t));
|
||||
}
|
||||
return getIntersectionType(propsApprentType);
|
||||
}
|
||||
return getIntersectionType(propsApprentType);
|
||||
return getApparentType(propsType);
|
||||
}
|
||||
return propsType;
|
||||
}
|
||||
@ -13579,7 +13582,7 @@ namespace ts {
|
||||
if (callSignature !== unknownSignature) {
|
||||
const callReturnType = callSignature && getReturnTypeOfSignature(callSignature);
|
||||
let paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0]));
|
||||
paramType = createIntersectionOfApparentTypeOfJsxPropsType(paramType);
|
||||
paramType = getApparentTypeOfJsxPropsType(paramType);
|
||||
if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) {
|
||||
// Intersect in JSX.IntrinsicAttributes if it exists
|
||||
const intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes);
|
||||
@ -13618,7 +13621,7 @@ namespace ts {
|
||||
for (const candidate of candidatesOutArray) {
|
||||
const callReturnType = getReturnTypeOfSignature(candidate);
|
||||
let paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0]));
|
||||
paramType = createIntersectionOfApparentTypeOfJsxPropsType(paramType);
|
||||
paramType = getApparentTypeOfJsxPropsType(paramType);
|
||||
if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) {
|
||||
let shouldBeCandidate = true;
|
||||
for (const attribute of openingLikeElement.attributes.properties) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user