GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Template type checking re-builds do not run correctly when referencing a re-exported type · Issue #21757 · angular/angular-cli

Template type checking re-builds do not run correctly when referencing a re-exported type #21757

New issue
Copy link
New issue
Copy link
Open
Open
Template type checking re-builds do not run correctly when referencing a re-exported type#21757
Copy link
Labels
area: @ngtools/webpackneeds: investigationRequires some digging to determine if action is neededRequires some digging to determine if action is needed
Milestone
needsTriage

Description

@HazzMan2409
HazzMan2409
opened on Sep 15, 2021
Issue body actions

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

Consider the following example, running ng serve with template type checking turned on:

  • An Angular template references a property on the component class in an expression.
  • This component class properties type definition comes from a file which re-exports the type definition from another file.
  • Re-builds do not always re-compile the template expression when they should.

More specifically, in the reproduction repo this looks as follows:

  • The app component template includes an expression: {{ myType?.abc }}.
  • The app component class defines the myType property: myType?: MyTypeReExported.
  • The type of the myType property comes from a file which re-exports another type. export type MyTypeRexported = MyType.
  • The type MyType comes from a file which defines the definition as: export interface MyType { abc: 123; }.
  • The initial ng serve will run without errors.
  • Changing the type definition of MyType to be export interface MyType { abcd: 123; } causes an error in the app component's template. This is seen in the re-build console output. This is the correct behaviour.
  • Changing the type definition back to what it was originally should remove the error. However, it does not. That is the bug.

Please provide a link to a minimal reproduction of the bug

https://github.com/HazzMan2409/angular-template-rebuild-bug

Please provide the environment you discovered this bug in

Angular 12.2.5.
Node 14.17.6

See the package.json on the repo for more details. At the time 12.2.5 was the latest version.

Activity

  1. JoostK
    transferred this issue fromangular/angularon Sep 15, 2021
  2. JoostK commented on Sep 15, 2021

    @JoostK
    JoostK
    on Sep 15, 2021
    Member
    More actions

    Moving to the CLI repo as this is a bug in incremental type-checking and not observed with just ngc.

  3. clydin
    added
    needs: investigationRequires some digging to determine if action is neededRequires some digging to determine if action is needed
    on Sep 15, 2021
  4. JoostK commented on Sep 15, 2021

    @JoostK
    JoostK
    on Sep 15, 2021
    Member
    More actions

    A quick update after debugging through the incremental type-checking logic: this issue occurs due to how TypeScript's builder APIs for incremental diagnostics computations fail to report indirectly affected files as affected, which causes the CLI to be unaware of those cache invalidations. The TS builder implementation only wipes its internal diagnostics cache for indirectly affected files (assuming that the assumeChangesOnlyAffectDirectDependencies compiler option is not set) but this side-effect cannot be observed using the builder's APIs, so we're left in the dark here.

  5. JoostK commented on Sep 15, 2021

    @JoostK
    JoostK
    on Sep 15, 2021
    Member
    More actions

    The same issue also occurs for the more common pattern of having indirect property accesses and changing a nested property's signature; we're only recomputing typecheck results for the affected files based on the import graph but not based on signature changes.

  6. alan-agius4
    added
    area: @ngtools/webpack
    on Sep 21, 2021
  7. ngbot
    added this to the needsTriage milestone on Sep 21, 2021
  8. clydin
    added
    2022Q3 Fixit
    on Jun 27, 2022
  9. alan-agius4
    removed
    2022Q3 Fixit
    on Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @ngtools/webpackneeds: investigationRequires some digging to determine if action is neededRequires some digging to determine if action is needed

    Type

    No type

    Projects

    No projects

      Milestone

      • needsTriageNo due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.