Skip to content

Persistent application-builder cache retains inherited class members after removing extends #33608

Description

@PavolSvidran

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

After migrating an application from Angular 18 to Angular 21 and moving
to the new application builder, the persistent build cache can retain
stale TypeScript class-shape information.

ZfTranslateService originally extended TranslateService. Multiple
consumers called inherited methods such as getCurrentLang(), instant(),
and setFallbackLang().

I then removed extends TranslateService and injected TranslateService
through composition instead. The inherited methods were no longer exposed
by ZfTranslateService.

Additional observations:

  • tsc --noEmit -p tsconfig.app.json correctly reports 15 TS2339 errors.
  • --traceResolution confirms all imports resolve to the edited source file.
  • Deleting the workspace .angular directory makes the Angular builder
    immediately report the expected errors.
  • Therefore the stale state is in the Angular persistent disk cache rather
    than TypeScript module resolution or the running dev-server process.

Minimal Reproduction

ZfTranslateService originally extended TranslateService (@ngx-translate). Multiple
consumers called inherited methods such as getCurrentLang(), instant(),
and setFallbackLang().

I then removed extends TranslateService and injected TranslateService
through composition instead. The inherited methods were no longer exposed
by ZfTranslateService.

Exception or Error

Expected:
The Angular build reports TS2339 errors at all consumers.

Actual:
The Angular build succeeds, including after stopping and restarting all
development servers.

Your Environment

     _                          _                    ____ _    ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI       : 21.2.19
Angular           : 21.2.18
Node.js           : 22.22.1
Package Manager   : npm 10.9.4
Operating System  : linux x64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations       │ 21.2.18           │ 21.2.18           │
│ @angular/build            │ 21.2.19           │ 21.2.19           │
│ @angular/cdk              │ 21.2.14           │ 21.2.14           │
│ @angular/cli              │ 21.2.19           │ 21.2.19           │
│ @angular/common           │ 21.2.18           │ 21.2.18           │
│ @angular/compiler         │ 21.2.18           │ 21.2.18           │
│ @angular/compiler-cli     │ 21.2.18           │ 21.2.18           │
│ @angular/core             │ 21.2.18           │ 21.2.18           │
│ @angular/forms            │ 21.2.18           │ 21.2.18           │
│ @angular/localize         │ 21.2.18           │ 21.2.18           │
│ @angular/platform-browser │ 21.2.18           │ 21.2.18           │
│ @angular/router           │ 21.2.18           │ 21.2.18           │
│ rxjs                      │ 7.8.2             │ 7.8.2             │
│ typescript                │ 5.9.3             │ 5.9.3             │
│ zone.js                   │ 0.15.1            │ 0.15.1            │
└───────────────────────────┴───────────────────┴───────────────────┘

NodeV: v22.22.1
Npm: 10.9.4

Cache Information

Enabled           : Yes
Environment       : all
Path              : /home/***/*****/webApp/.angular/cache
Size on disk      : 487.89 kB
Effective Status  : Enabled (current machine)


 "builder": "@angular/build:application"

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular/buildgemini-triagedLabel noting that an issue has been triaged by geminineeds: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions