File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -3797,12 +3797,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
37973797 // For other files (not node16/nodenext with impliedNodeFormat), check if we can determine
37983798 // the module format from project references
37993799 if (!targetMode && file.isDeclarationFile) {
3800- const redirect = host.getRedirectFromSourceFile(file.path);
3800+ // Try to get the project reference - try both source file mapping and output file mapping
3801+ // since declaration files can be mapped either way depending on how they're resolved
3802+ const redirect = host.getRedirectFromSourceFile(file.path) || host.getRedirectFromOutput(file.path);
38013803 if (redirect) {
38023804 // This is a declaration file from a project reference, so we can determine
38033805 // its module format from the referenced project's options
38043806 const targetModuleKind = host.getEmitModuleFormatOfFile(file);
3805- if (usageMode === ModuleKind.ESNext && targetModuleKind > = ModuleKind.ES2015 ) {
3807+ if (usageMode === ModuleKind.ESNext && ModuleKind.ES2015 <= targetModuleKind && targetModuleKind < = ModuleKind.ESNext ) {
38063808 return false;
38073809 }
38083810 }
You can’t perform that action at this time.
0 commit comments