Fix #8507: Consider UnknownSymbols values for import/export purposes

This commit is contained in:
Mohamed Hegazy
2016-05-06 17:32:45 -07:00
parent 33abdadbeb
commit b4becd46ec
35 changed files with 96 additions and 19 deletions

View File

@@ -1133,9 +1133,8 @@ namespace ts {
const symbol = getSymbolOfNode(node);
const target = resolveAlias(symbol);
if (target) {
const markAlias =
(target === unknownSymbol && compilerOptions.isolatedModules) ||
(target !== unknownSymbol && (target.flags & SymbolFlags.Value) && !isConstEnumOrConstEnumOnlyModule(target));
const markAlias = target === unknownSymbol ||
((target.flags & SymbolFlags.Value) && !isConstEnumOrConstEnumOnlyModule(target));
if (markAlias) {
markAliasSymbolAsReferenced(symbol);
@@ -16983,14 +16982,12 @@ namespace ts {
function isAliasResolvedToValue(symbol: Symbol): boolean {
const target = resolveAlias(symbol);
if (target === unknownSymbol && compilerOptions.isolatedModules) {
if (target === unknownSymbol) {
return true;
}
// const enums and modules that contain only const enums are not considered values from the emit perspective
// unless 'preserveConstEnums' option is set to true
return target !== unknownSymbol &&
target &&
target.flags & SymbolFlags.Value &&
return target.flags & SymbolFlags.Value &&
(compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));
}