From 548b7f93469f4d0b7b98c1ec43e289679900c1db Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 31 Jan 2020 14:52:17 -0800 Subject: [PATCH] resolvedJSDocType should cache on node, not symbol --- 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 542c6f6e19022..45d5aa1638282 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -163,7 +163,6 @@ namespace ts { ResolvedReturnType, ImmediateBaseConstraint, EnumTagType, - JSDocTypeReference, ResolvedTypeArguments, } @@ -6915,8 +6914,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; } @@ -11179,7 +11176,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 3525b12a8a440..7155ccb1d2ff2 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