angular / angular/components

bug(all): "color" input is not typechecked

Aperta
#27,172 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

### 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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo lo StackBlitz collegato con i controlli rigorosi dei template abilitati, concentrandoti sugli input del colore di mat-button e mat-checkbox. Esamina come sono dichiarati questi input nei componenti interessati; il lavoro è completato quando i valori non validi, come i numeri, non superano la compilazione e producono un errore di tipo non corretto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.