Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3869,7 +3869,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return exportDefaultSymbol;
}
const hasDefaultOnly = isOnlyImportableAsDefault(specifier, moduleSymbol);
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
let hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
// For export specifiers re-exporting 'default' from declaration files, when allowSyntheticDefaultImports
// is enabled, allow synthetic default. Declaration files may correspond to CommonJS modules at runtime,
// where a default import is allowed to reference the whole module.exports symbol.
if (!hasSyntheticDefault && isExportSpecifier(node) && allowSyntheticDefaultImports && (!file || file.isDeclarationFile)) {
hasSyntheticDefault = true;
}
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
const compilerOptionName = moduleKind >= ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
Expand Down