mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Add a seperate cache for the all attributes version of the jsx attributes type (#17620)
This commit is contained in:
parent
af20adb137
commit
a46d6bde97
@ -14107,11 +14107,8 @@ namespace ts {
|
||||
*/
|
||||
function resolveCustomJsxElementAttributesType(openingLikeElement: JsxOpeningLikeElement,
|
||||
shouldIncludeAllStatelessAttributesType: boolean,
|
||||
elementType?: Type,
|
||||
elementType: Type = checkExpression(openingLikeElement.tagName),
|
||||
elementClassType?: Type): Type {
|
||||
if (!elementType) {
|
||||
elementType = checkExpression(openingLikeElement.tagName);
|
||||
}
|
||||
|
||||
if (elementType.flags & TypeFlags.Union) {
|
||||
const types = (elementType as UnionType).types;
|
||||
@ -14245,11 +14242,12 @@ namespace ts {
|
||||
*/
|
||||
function getCustomJsxElementAttributesType(node: JsxOpeningLikeElement, shouldIncludeAllStatelessAttributesType: boolean): Type {
|
||||
const links = getNodeLinks(node);
|
||||
if (!links.resolvedJsxElementAttributesType) {
|
||||
const linkLocation = shouldIncludeAllStatelessAttributesType ? "resolvedJsxElementAllAttributesType" : "resolvedJsxElementAttributesType";
|
||||
if (!links[linkLocation]) {
|
||||
const elemClassType = getJsxGlobalElementClassType();
|
||||
return links.resolvedJsxElementAttributesType = resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, /*elementType*/ undefined, elemClassType);
|
||||
return links[linkLocation] = resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, /*elementType*/ undefined, elemClassType);
|
||||
}
|
||||
return links.resolvedJsxElementAttributesType;
|
||||
return links[linkLocation];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -3067,6 +3067,7 @@ namespace ts {
|
||||
hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context
|
||||
jsxFlags?: JsxFlags; // flags for knowing what kind of element/attributes we're dealing with
|
||||
resolvedJsxElementAttributesType?: Type; // resolved element attributes type of a JSX openinglike element
|
||||
resolvedJsxElementAllAttributesType?: Type; // resolved all element attributes type of a JSX openinglike element
|
||||
hasSuperCall?: boolean; // recorded result when we try to find super-call. We only try to find one if this flag is undefined, indicating that we haven't made an attempt.
|
||||
superCall?: ExpressionStatement; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
|
||||
switchTypes?: Type[]; // Cached array of switch case expression types
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user