angular / angular/angular-cli

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

Ouverte
#21,757 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area: @ngtools/webpack needs: investigation
Langage dominant
TypeScript
Étoiles
27k
Forks
11.8k
Merge moyen
14 h 23 min
PR mergées (30 j)
162

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

```true
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.
```

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la reproduction minimale liée et exécutez ng serve avec la vérification des types des templates activée sur les versions d’Angular et de Node indiquées. Modifiez MyType entre les définitions abc et abcd, puis inspectez les chemins de rebuild d’Angular CLI et de vérification des types des templates. Le travail est terminé lorsque la réversion de la définition de type supprime l’erreur du template lors du rebuild.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
build-system
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.