angular / angular/components

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

Abierto
#27,172 1 comentario 0 reacciones 0 asignados Ver en GitHub
P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza reproduciendo el StackBlitz enlazado con las comprobaciones estrictas de plantillas activadas, centrándote en las entradas de color de mat-button y mat-checkbox. Inspecciona cómo se declaran esas entradas en los componentes afectados; el trabajo estará terminado cuando los valores no válidos, como los números, fallen al compilar con un error de tipo incorrecto.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.