chartjs / chartjs/Chart.js

Type error setting pointStype to false

オープン
#11,368 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
type: bug type: types
主要言語
JavaScript
スター
67.7k
フォーク
11.9k
平均マージ
7時間 39分
マージ済み PR(30日)
5

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。