Skip to content

Commit 1f9e090

Browse files
crisbetothePunderWoman
authored andcommitted
fix(compiler-cli): emitting references to ngtypecheck files (#57138) (#57202)
Follow-up to #56961 which doesn't appear to have caught all the cases. This change moves the pre-emit untagging to `NgCompiler.prepareEmit` which seems to cover a bit more comared to `NgtscProgram.emit`. Fixes #57135. PR Close #57138 PR Close #57202
1 parent 62ade76 commit 1f9e090

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

packages/compiler-cli/src/ngtsc/core/src/compiler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ import {DiagnosticCategoryLabel, NgCompilerAdapter, NgCompilerOptions} from '../
124124

125125
import {coreHasSymbol} from './core_version';
126126
import {coreVersionSupportsFeature} from './feature_detection';
127+
import {untagAllTsFiles} from '../../shims';
127128

128129
/**
129130
* State information about a compilation which is only generated once some data is requested from
@@ -789,6 +790,10 @@ export class NgCompiler {
789790
} {
790791
const compilation = this.ensureAnalyzed();
791792

793+
// Untag all the files, otherwise TS 5.4 may end up emitting
794+
// references to typecheck files (see #56945 and #57135).
795+
untagAllTsFiles(this.inputProgram);
796+
792797
const coreImportsFrom = compilation.isCore ? getR3SymbolsFile(this.inputProgram) : null;
793798
let importRewriter: ImportRewriter;
794799
if (coreImportsFrom !== null) {

packages/compiler-cli/src/ngtsc/program.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {IndexedComponent} from './indexer';
2828
import {ActivePerfRecorder, PerfCheckpoint as PerfCheckpoint, PerfEvent, PerfPhase} from './perf';
2929
import {TsCreateProgramDriver} from './program_driver';
3030
import {DeclarationNode} from './reflection';
31-
import {retagAllTsFiles, untagAllTsFiles} from './shims';
31+
import {retagAllTsFiles} from './shims';
3232
import {OptimizeFor} from './typecheck/api';
3333

3434
/**
@@ -293,10 +293,6 @@ export class NgtscProgram implements api.Program {
293293
}
294294
}
295295

296-
// Untag all the files, otherwise TS 5.4 may end up emitting
297-
// references to typecheck files (see #56945).
298-
untagAllTsFiles(this.tsProgram);
299-
300296
const forceEmit = opts?.forceEmit ?? false;
301297

302298
this.compiler.perfRecorder.memory(PerfCheckpoint.PreEmit);

0 commit comments

Comments
 (0)