Type error setting pointStype to false
- Ngôn ngữ chính
- JavaScript
- Star
- 67.7k
- Fork
- 11.9k
- Merge trung bình
- 7 giờ 39 phút
- Pull request đã merge (30 ngày)
- 5
Mô tả
### Expected behavior
I hope I can define a dataset with a boolean pointStyle without getting a typing error
### Current behavior
When i add the following config:
```typescript
new Chart(canvas, {
type: 'line',
data: {
labels: generateLabels(),
datasets: [
{
label: 'Dataset',
data: generateData(),
pointStyle: false, <--
},
],
}
```
I get the following typing error
_Type '{ pointStyle: boolean; }' is not assignable to type 'ChartDatasetCustomTypesPerDataset<"line", number[]>'._
### Reproducible sample
https://codesandbox.io/s/ng2charts-chart-js-issue-template-forked-r5kcm4
Updated example: https://codesandbox.io/s/ng2charts-chart-js-issue-template-forked-6fd62d?file=/src/app/app.component.ts
(does not complain about the boolean type, but neither does it complain about an invalid string type)
### Optional extra steps/info to reproduce
_No response_
### Possible solution
It is currently "fixed" by forcing a type as shown here
`pointStyle: false as unknown as string,`
but I wouldn't want to have to do this.
### Context
I am working on Angular 16
### chart.js version
4.3.0
### Browser name and version
Firefox Developer Edition 115.0b9 (64-bit) on Ubuntu
### Link to your project
_No response_
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Start with the Chart.js TypeScript dataset configuration for a line chart and trace the declared type of the pointStyle property. Use the updated CodeSandbox to verify that false is accepted while an invalid string remains rejected; done means the reported typing error is resolved without the workaround.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, typescript
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- 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
- 42/100