(symbol, location)
| 71397 | } |
| 71398 | } |
| 71399 | function getTypeOfSymbolAtLocation(symbol, location) { |
| 71400 | symbol = symbol.exportSymbol || symbol; |
| 71401 | // If we have an identifier or a property access at the given location, if the location is |
| 71402 | // an dotted name expression, and if the location is not an assignment target, obtain the type |
| 71403 | // of the expression (which will reflect control flow analysis). If the expression indeed |
| 71404 | // resolved to the given symbol, return the narrowed type. |
| 71405 | if (location.kind === 79 /* SyntaxKind.Identifier */ || location.kind === 80 /* SyntaxKind.PrivateIdentifier */) { |
| 71406 | if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { |
| 71407 | location = location.parent; |
| 71408 | } |
| 71409 | if (ts.isExpressionNode(location) && (!ts.isAssignmentTarget(location) || ts.isWriteAccess(location))) { |
| 71410 | var type = getTypeOfExpression(location); |
| 71411 | if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { |
| 71412 | return type; |
| 71413 | } |
| 71414 | } |
| 71415 | } |
| 71416 | if (ts.isDeclarationName(location) && ts.isSetAccessor(location.parent) && getAnnotatedAccessorTypeNode(location.parent)) { |
| 71417 | return getWriteTypeOfAccessors(location.parent.symbol); |
| 71418 | } |
| 71419 | // The location isn't a reference to the given symbol, meaning we're being asked |
| 71420 | // a hypothetical question of what type the symbol would have if there was a reference |
| 71421 | // to it at the given location. Since we have no control flow information for the |
| 71422 | // hypothetical reference (control flow information is created and attached by the |
| 71423 | // binder), we simply return the declared type of the symbol. |
| 71424 | return getNonMissingTypeOfSymbol(symbol); |
| 71425 | } |
| 71426 | function getControlFlowContainer(node) { |
| 71427 | return ts.findAncestor(node.parent, function (node) { |
| 71428 | return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || |
no test coverage detected
searching dependent graphs…