From 818bfdcd88c798e2b6141e9f1cfd8082d7b9d710 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 5 May 2017 15:08:02 -0700 Subject: [PATCH] accessibility check --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6496b191eac..5302f43bcc7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2443,11 +2443,11 @@ namespace ts { if (type.flags & TypeFlags.TypeParameter) { const name = symbolToName(type.symbol, /*expectsIdentifier*/ false, context); // Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter. - // TODO: add constraint here? return createTypeReferenceNode(name, /*typeArguments*/ undefined); } - if (!inTypeAlias && type.aliasSymbol) { + if (!inTypeAlias && type.aliasSymbol && + isSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration, SymbolFlags.Type, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === SymbolAccessibility.Accessible) { const name = symbolToName(type.aliasSymbol, /*expectsIdentifier*/ false, context); const typeArgumentNodes = type.aliasTypeArguments && mapToTypeNodeArray(type.aliasTypeArguments, /*addInElementTypeFlag*/ false); return createTypeReferenceNode(name, typeArgumentNodes);