Skip to content

Commit 2e1ddde

Browse files
mprobstAndrewKushnir
authored andcommitted
fix(compiler-cli): support hasInvalidatedResolutions. (angular#47585)
The latest TypeScript compiler exposes the previously private field `hasInvalidatedResolutions`. That breaks Angular in the newer TS, because the new field would be required on DelegatingCompilerHost. However we cannot just add the field here, because it's not present in the older compiler. This change adds the field for delegation, which works at runtime because the field is present. It suppresses the compiler error using a `// @ts-expect-error`, which should be removed once Angular moves to a TSC version that includes this change. PR Close angular#47585
1 parent c3f8579 commit 2e1ddde

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export class DelegatingCompilerHost implements
6868
useCaseSensitiveFileNames = this.delegateMethod('useCaseSensitiveFileNames');
6969
writeFile = this.delegateMethod('writeFile');
7070
getModuleResolutionCache = this.delegateMethod('getModuleResolutionCache');
71+
// @ts-expect-error 'hasInvalidatedResolutions' is visible (and thus required here) in latest TSC
72+
// main. It's already present, so the code works at runtime.
73+
// TODO: remove this comment including the suppression once Angular uses a TSC version that
74+
// includes this change (github.com/microsoft/TypeScript@a455955).
75+
hasInvalidatedResolutions = this.delegateMethod('hasInvalidatedResolutions');
7176
}
7277

7378
/**

packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export class DelegatingCompilerHost implements
5252
trace = this.delegateMethod('trace');
5353
useCaseSensitiveFileNames = this.delegateMethod('useCaseSensitiveFileNames');
5454
getModuleResolutionCache = this.delegateMethod('getModuleResolutionCache');
55+
// @ts-expect-error 'hasInvalidatedResolutions' is visible (and thus required here) in latest TSC
56+
// main. It's already present, so the code works at runtime.
57+
// TODO: remove this comment including the suppression once Angular uses a TSC version that
58+
// includes this change (github.com/microsoft/TypeScript@a455955).
59+
hasInvalidatedResolutions = this.delegateMethod('hasInvalidatedResolutions');
5560
}
5661

5762
/**

0 commit comments

Comments
 (0)