@@ -934,6 +934,7 @@ import {
934934    ShorthandPropertyAssignment,
935935    shouldAllowImportingTsExtension,
936936    shouldPreserveConstEnums,
937+     shouldResolveJsRequire,
937938    Signature,
938939    SignatureDeclaration,
939940    SignatureFlags,
@@ -3995,7 +3996,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
39953996        const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
39963997        const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
39973998        if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
3998-             if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions)) ) {
3999+             if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports ) {
39994000                const compilerOptionName = moduleKind >= ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
40004001                const exportEqualsSymbol = moduleSymbol.exports!.get(InternalSymbolName.ExportEquals);
40014002                const exportAssignment = exportEqualsSymbol!.valueDeclaration;
@@ -4138,7 +4139,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
41384139        if (!isIdentifier(name)) {
41394140            return undefined;
41404141        }
4141-         const suppressInteropError = name.escapedText === InternalSymbolName.Default && !!(compilerOptions. allowSyntheticDefaultImports || getESModuleInterop(compilerOptions)) ;
4142+         const suppressInteropError = name.escapedText === InternalSymbolName.Default && allowSyntheticDefaultImports;
41424143        const targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, /*dontResolveAlias*/ false, suppressInteropError);
41434144        if (targetSymbol) {
41444145            if (name.escapedText) {
@@ -9177,7 +9178,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
91779178                // If `target` refers to a shorthand module symbol, the name we're trying to pull out isn;t recoverable from the target symbol
91789179                // In such a scenario, we must fall back to looking for an alias declaration on `symbol` and pulling the target name from that
91799180                let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
9180-                 if (verbatimTargetName === InternalSymbolName.ExportEquals && (getESModuleInterop(compilerOptions) || compilerOptions. allowSyntheticDefaultImports) ) {
9181+                 if (verbatimTargetName === InternalSymbolName.ExportEquals && allowSyntheticDefaultImports) {
91819182                    // target refers to an `export=` symbol that was hoisted into a synthetic default - rename here to match
91829183                    verbatimTargetName = InternalSymbolName.Default;
91839184                }
@@ -33993,7 +33994,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3399333994        }
3399433995
3399533996        // In JavaScript files, calls to any identifier 'require' are treated as external module imports
33996-         if (isInJSFile(node) && getEmitModuleResolutionKind (compilerOptions) !== ModuleResolutionKind.Bundler  && isCommonJsRequire(node)) {
33997+         if (isInJSFile(node) && shouldResolveJsRequire (compilerOptions) && isCommonJsRequire(node)) {
3399733998            return resolveExternalModuleTypeByLiteral(node.arguments![0] as StringLiteral);
3399833999        }
3399934000
0 commit comments