bug(all): "color" input is not typechecked
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
### 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.
Contributor guide
Research direction
Start by reproducing the linked StackBlitz with strict template checks enabled, focusing on the mat-button and mat-checkbox color inputs. Inspect how those inputs are declared across the affected components; the work is done when invalid values such as numbers fail compilation with an incorrect-type error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100