* ```ts * function f() {} * f.foo = 0; * ``` * * Here, `f` has two declarations: the function declaration, and the identifier in the next line. * The latter is a declaration for `f` because it gives `f` the `SymbolFlags.Namespace` meaning so
(node)
| 139981 | * up with a more precise definition of what counts as a definition. |
| 139982 | */ |
| 139983 | function isExpandoDeclaration(node) { |
| 139984 | if (!ts.isAssignmentDeclaration(node)) |
| 139985 | return false; |
| 139986 | var containingAssignment = ts.findAncestor(node, function (p) { |
| 139987 | if (ts.isAssignmentExpression(p)) |
| 139988 | return true; |
| 139989 | if (!ts.isAssignmentDeclaration(p)) |
| 139990 | return "quit"; |
| 139991 | return false; |
| 139992 | }); |
| 139993 | return !!containingAssignment && ts.getAssignmentDeclarationKind(containingAssignment) === 5 /* AssignmentDeclarationKind.Property */; |
| 139994 | } |
| 139995 | function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) { |
| 139996 | var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== excludeDeclaration; }); |
| 139997 | var withoutExpandos = ts.filter(filteredDeclarations, function (d) { return !isExpandoDeclaration(d); }); |
no outgoing calls
no test coverage detected