Use merged symbol to pick up js-alias-merged members on export assignments (#37162)

This commit is contained in:
Wesley Wigham
2020-03-02 12:57:00 -08:00
committed by GitHub
parent 24b926f0f9
commit d209092ccc
5 changed files with 99 additions and 1 deletions

View File

@@ -6138,7 +6138,7 @@ namespace ts {
const varName = getUnusedName(name, symbol);
// We have to use `getWidenedType` here since the object within a json file is unwidened within the file
// (Unwidened types can only exist in expression contexts and should never be serialized)
const typeToSerialize = getWidenedType(getTypeOfSymbol(symbol));
const typeToSerialize = getWidenedType(getTypeOfSymbol(getMergedSymbol(symbol)));
if (isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, symbol)) {
// If there are no index signatures and `typeToSerialize` is an object type, emit as a namespace instead of a const
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignment ? ModifierFlags.None : ModifierFlags.Export);