@@ -1762,9 +1762,9 @@ namespace ts {
1762
1762
* Check if the given symbol in given enclosing declaration is accessible and mark all associated alias to be visible if requested
1763
1763
*
1764
1764
* @param symbol a Symbol to check if accessible
1765
- * @param enclosingDeclaration a Node containing the symbol
1765
+ * @param enclosingDeclaration a Node containing reference to the symbol
1766
1766
* @param meaning a SymbolFlags to check if such meaning of the symbol is accessible
1767
- * @param shouldComputeAliasToMarkVisible a boolean value to indicate whether to return aliases to be mark visible in case the symbol is accessible
1767
+ * @param shouldComputeAliasToMakeVisible a boolean value to indicate whether to return aliases to be mark visible in case the symbol is accessible
1768
1768
*/
1769
1769
function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, shouldComputeAliasesToMakeVisible: boolean): SymbolAccessibilityResult {
1770
1770
if (symbol && enclosingDeclaration && !(symbol.flags & SymbolFlags.TypeParameter)) {
@@ -1838,7 +1838,7 @@ namespace ts {
1838
1838
return isAmbientModule(declaration) || (declaration.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(<SourceFile>declaration));
1839
1839
}
1840
1840
1841
- function hasVisibleDeclarations(symbol: Symbol, shouldComputeAliasToMarkVisible : boolean): SymbolVisibilityResult {
1841
+ function hasVisibleDeclarations(symbol: Symbol, shouldComputeAliasToMakeVisible : boolean): SymbolVisibilityResult {
1842
1842
let aliasesToMakeVisible: AnyImportSyntax[];
1843
1843
if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) {
1844
1844
return undefined;
@@ -1854,7 +1854,10 @@ namespace ts {
1854
1854
if (anyImportSyntax &&
1855
1855
!(getModifierFlags(anyImportSyntax) & ModifierFlags.Export) && // import clause without export
1856
1856
isDeclarationVisible(<Declaration>anyImportSyntax.parent)) {
1857
- if (shouldComputeAliasToMarkVisible) {
1857
+ // In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types,
1858
+ // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time
1859
+ // since we will do the emitting later in trackSymbol.
1860
+ if (shouldComputeAliasToMakeVisible) {
1858
1861
getNodeLinks(declaration).isVisible = true;
1859
1862
if (aliasesToMakeVisible) {
1860
1863
if (!contains(aliasesToMakeVisible, anyImportSyntax)) {
@@ -1898,7 +1901,7 @@ namespace ts {
1898
1901
const symbol = resolveName(enclosingDeclaration, (<Identifier>firstIdentifier).text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);
1899
1902
1900
1903
// Verify if the symbol is accessible
1901
- return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMarkVisible */ true)) || <SymbolVisibilityResult>{
1904
+ return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible */ true)) || <SymbolVisibilityResult>{
1902
1905
accessibility: SymbolAccessibility.NotAccessible,
1903
1906
errorSymbolName: getTextOfNode(firstIdentifier),
1904
1907
errorNode: firstIdentifier
0 commit comments