(node *ast.Node)
| 22907 | } |
| 22908 | |
| 22909 | func (c *Checker) getTypeFromTypeReference(node *ast.Node) *Type { |
| 22910 | links := c.typeNodeLinks.Get(node) |
| 22911 | if links.resolvedType == nil { |
| 22912 | // Cache both the resolved symbol and the resolved type. The resolved symbol is needed when we check the |
| 22913 | // type reference in checkTypeReferenceNode. |
| 22914 | // handle LS queries on the `const` in `x as const` by resolving to the type of `x` |
| 22915 | if isConstTypeReference(node) && ast.IsAssertionExpression(node.Parent) { |
| 22916 | links.resolvedType = c.checkExpressionCached(node.Parent.Expression()) |
| 22917 | } else if t := c.getIntendedTypeFromJSDocTypeReference(node); t != nil { |
| 22918 | links.resolvedType = t |
| 22919 | } else { |
| 22920 | links.resolvedType = c.getTypeReferenceType(node, c.getSymbolFromTypeReference(node)) |
| 22921 | } |
| 22922 | } |
| 22923 | return links.resolvedType |
| 22924 | } |
| 22925 | |
| 22926 | func (c *Checker) getIntendedTypeFromJSDocTypeReference(node *ast.Node) *Type { |
| 22927 | if node.Flags&ast.NodeFlagsJSDoc != 0 && ast.IsTypeReferenceNode(node) { |
no test coverage detected