From ad249043da4edcb03b9076e4b18ff1d3398ba8cd Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 31 Jan 2020 15:19:45 -0800 Subject: [PATCH] resolvedJSDocType should cache on node, not symbol (#36561) --- src/compiler/checker.ts | 5 +---- src/compiler/types.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8f473db8b6b..d139935f420 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -163,7 +163,6 @@ namespace ts { ResolvedReturnType, ImmediateBaseConstraint, EnumTagType, - JSDocTypeReference, ResolvedTypeArguments, } @@ -6920,8 +6919,6 @@ namespace ts { return !!(target).resolvedReturnType; case TypeSystemPropertyName.ImmediateBaseConstraint: return !!(target).immediateBaseConstraint; - case TypeSystemPropertyName.JSDocTypeReference: - return !!getSymbolLinks(target as Symbol).resolvedJSDocType; case TypeSystemPropertyName.ResolvedTypeArguments: return !!(target as TypeReference).resolvedTypeArguments; } @@ -11184,7 +11181,7 @@ namespace ts { * but this function's special-case code fakes alias resolution as well. */ function getTypeFromJSDocValueReference(node: NodeWithTypeArguments, symbol: Symbol): Type | undefined { - const links = getSymbolLinks(symbol); + const links = getNodeLinks(node); if (!links.resolvedJSDocType) { const valueType = getTypeOfSymbol(symbol); let typeType = valueType; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 3525b12a8a4..7155ccb1d2f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4063,7 +4063,6 @@ namespace ts { nameType?: Type; // Type associated with a late-bound symbol uniqueESSymbolType?: Type; // UniqueESSymbol type for a symbol declaredType?: Type; // Type of class, interface, enum, type alias, or type parameter - resolvedJSDocType?: Type; // Resolved type of a JSDoc type reference typeParameters?: TypeParameter[]; // Type parameters of type alias (undefined if non-generic) outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type instantiations?: Map; // Instantiations of generic type alias (undefined if non-generic) @@ -4239,6 +4238,7 @@ namespace ts { 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 + resolvedJSDocType?: Type; // Resolved type of a JSDoc type reference 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?: SuperCall; // 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