diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cbdbd55660bcd..82af4ae53b10c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3806,10 +3806,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // it definitely is a module and does not have a synthetic default return false; } - // There are _many_ declaration files not written with esmodules in mind that still get compiled into a format with __esModule set - // Meaning there may be no default at runtime - however to be on the permissive side, we allow access to a synthetic default member - // as there is no marker to indicate if the accompanying JS has `__esModule` or not, or is even native esm - return true; + if (!file && getSourceFileOfModule(moduleSymbol)?.fileName.includes("/@types/node/")) { + return true; + } + return hasExportAssignmentSymbol(moduleSymbol); } // TypeScript files never have a synthetic default (as they are always emitted with an __esModule marker) _unless_ they contain an export= statement if (!isSourceFileJS(file)) {