bug(all): "color" input is not typechecked
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
### 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
The `color` input of multiple components is not typechecked. It accepts arbitrary strings or even non-string values.
The previous bug report was closed without an action: https://github.com/angular/components/issues/24089
### Reproduction
https://stackblitz.com/edit/urch5g?file=src%2Fexample%2Fbutton-overview-example.html
Note that strict template checks are enabled. If you try to pass an incorrect value (e.g. a number) to the `indeterminate` input of the `mat-checkbox`, the compilation will fail, as expected.
### Expected Behavior
Compilation fails, error message says the value for the `color` input is of incorrect type
### Actual Behavior
The stackblitz example compiles and runs well, despite bogus color values passed to `mat-button` and `mat-checkbox`.
### Environment
The stackblitz above is latest angular - 16 (forked off an example in the Material docs). But it's observed in Angular 15 (various minor versions), and earlier.
Beitragsleitfaden
Rechercherichtung
Beginne damit, den verlinkten StackBlitz mit aktivierten strikten Template-Prüfungen zu reproduzieren, wobei du dich auf die Farbeingaben von mat-button und mat-checkbox konzentrierst. Untersuche, wie diese Eingaben in den betroffenen Komponenten deklariert sind; die Arbeit ist abgeschlossen, wenn ungültige Werte wie Zahlen bei der Kompilierung mit einem Fehler wegen des falschen Typs fehlschlagen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, typescript
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100