mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
throw an error when no default export present (#35815)
This commit is contained in:
committed by
Wesley Wigham
parent
91ffa1c752
commit
daf786ecd0
@@ -2322,13 +2322,18 @@ namespace ts {
|
||||
else {
|
||||
symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText);
|
||||
}
|
||||
|
||||
// if symbolFromVariable is export - get its final target
|
||||
symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
|
||||
|
||||
let symbolFromModule = getExportOfModule(targetSymbol, name.escapedText, dontResolveAlias);
|
||||
// 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 (!symbolFromModule && allowSyntheticDefaultImports && name.escapedText === InternalSymbolName.Default) {
|
||||
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
||||
if (symbolFromModule === undefined && name.escapedText === InternalSymbolName.Default) {
|
||||
const file = find(moduleSymbol.declarations, isSourceFile);
|
||||
if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias)) {
|
||||
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
||||
}
|
||||
}
|
||||
|
||||
const symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ?
|
||||
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
|
||||
symbolFromModule || symbolFromVariable;
|
||||
|
||||
Reference in New Issue
Block a user