Fix #10083 - allowSyntheticDefaultImports alters getExternalModuleMember (#10096)

This commit is contained in:
Wesley Wigham
2016-08-02 12:34:23 -07:00
committed by GitHub
parent 4a470bd27c
commit 0eeb9cbd0c
15 changed files with 260 additions and 0 deletions

View File

@@ -1135,6 +1135,10 @@ namespace ts {
else {
symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text);
}
// If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default
if (!symbolFromVariable && allowSyntheticDefaultImports && name.text === "default") {
symbolFromVariable = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
// if symbolFromVariable is export - get its final target
symbolFromVariable = resolveSymbol(symbolFromVariable);
const symbolFromModule = getExportOfModule(targetSymbol, name.text);