Template type checking re-builds do not run correctly when referencing a re-exported type
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- angular, typescript
- Domain
- build-system
Research direction
Start with the linked minimal reproduction and run ng serve with template type checking enabled on the stated Angular and Node versions. Change MyType between the abc and abcd definitions, then inspect the Angular CLI rebuild and template type-checking paths. Done means reverting the type definition removes the template error on rebuild.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 27k
- Forks
- 11.8k
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 176
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from angular/angular-cli
-
area: @angular/build gemini-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
angular/angular-cli#33055 · 1 comment · 3 reactions ·
-
area: @angular/build gemini-triaged
Difficulty 4/5 3-5 days Newbie friendliness 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 assignee ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 assignee ·
All issues in angular/angular-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ontola/atomic-server#1625 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
melgarafael/DeskcommCRM#1451 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bot:ai-assisted component:compact-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
midnightntwrk/midnight-sdk#403 ·