(symbol, shouldComputeAliasToMakeVisible)
| 52130 | return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); |
| 52131 | } |
| 52132 | function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { |
| 52133 | var aliasesToMakeVisible; |
| 52134 | if (!ts.every(ts.filter(symbol.declarations, function (d) { return d.kind !== 79 /* SyntaxKind.Identifier */; }), getIsDeclarationVisible)) { |
| 52135 | return undefined; |
| 52136 | } |
| 52137 | return { accessibility: 0 /* SymbolAccessibility.Accessible */, aliasesToMakeVisible: aliasesToMakeVisible }; |
| 52138 | function getIsDeclarationVisible(declaration) { |
| 52139 | var _a, _b; |
| 52140 | if (!isDeclarationVisible(declaration)) { |
| 52141 | // Mark the unexported alias as visible if its parent is visible |
| 52142 | // because these kind of aliases can be used to name types in declaration file |
| 52143 | var anyImportSyntax = getAnyImportSyntax(declaration); |
| 52144 | if (anyImportSyntax && |
| 52145 | !ts.hasSyntacticModifier(anyImportSyntax, 1 /* ModifierFlags.Export */) && // import clause without export |
| 52146 | isDeclarationVisible(anyImportSyntax.parent)) { |
| 52147 | return addVisibleAlias(declaration, anyImportSyntax); |
| 52148 | } |
| 52149 | else if (ts.isVariableDeclaration(declaration) && ts.isVariableStatement(declaration.parent.parent) && |
| 52150 | !ts.hasSyntacticModifier(declaration.parent.parent, 1 /* ModifierFlags.Export */) && // unexported variable statement |
| 52151 | isDeclarationVisible(declaration.parent.parent.parent)) { |
| 52152 | return addVisibleAlias(declaration, declaration.parent.parent); |
| 52153 | } |
| 52154 | else if (ts.isLateVisibilityPaintedStatement(declaration) // unexported top-level statement |
| 52155 | && !ts.hasSyntacticModifier(declaration, 1 /* ModifierFlags.Export */) |
| 52156 | && isDeclarationVisible(declaration.parent)) { |
| 52157 | return addVisibleAlias(declaration, declaration); |
| 52158 | } |
| 52159 | else if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isBindingElement(declaration) && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent) // exported import-like top-level JS require statement |
| 52160 | && ts.isVariableDeclaration(declaration.parent.parent) |
| 52161 | && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent) |
| 52162 | && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1 /* ModifierFlags.Export */) |
| 52163 | && declaration.parent.parent.parent.parent.parent // check if the thing containing the variable statement is visible (ie, the file) |
| 52164 | && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) { |
| 52165 | return addVisibleAlias(declaration, declaration.parent.parent.parent.parent); |
| 52166 | } |
| 52167 | // Declaration is not visible |
| 52168 | return false; |
| 52169 | } |
| 52170 | return true; |
| 52171 | } |
| 52172 | function addVisibleAlias(declaration, aliasingStatement) { |
| 52173 | // In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types, |
| 52174 | // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time |
| 52175 | // since we will do the emitting later in trackSymbol. |
| 52176 | if (shouldComputeAliasToMakeVisible) { |
| 52177 | getNodeLinks(declaration).isVisible = true; |
| 52178 | aliasesToMakeVisible = ts.appendIfUnique(aliasesToMakeVisible, aliasingStatement); |
| 52179 | } |
| 52180 | return true; |
| 52181 | } |
| 52182 | } |
| 52183 | function isEntityNameVisible(entityName, enclosingDeclaration) { |
| 52184 | // get symbol of the first identifier of the entityName |
| 52185 | var meaning; |
no test coverage detected