angular / angular/components

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

Đang mở
#27,172 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện StackBlitz được liên kết với strict template checks được bật, tập trung vào các input màu của mat-button và mat-checkbox. Kiểm tra cách các input đó được khai báo trong các component bị ảnh hưởng; công việc hoàn tất khi các giá trị không hợp lệ như số khiến quá trình biên dịch thất bại với lỗi sai kiểu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.