From aee979da540fbfb2329397def4c746a5f9a549ff Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Sat, 13 Mar 2021 15:04:59 +0200 Subject: [PATCH] Types: fix bubble chart options (#8625) --- test/types/simple.ts | 25 ------------------- types/index.esm.d.ts | 4 +-- .../tests/controllers/bubble_chart_options.ts | 22 ++++++++++++++++ 3 files changed, 24 insertions(+), 27 deletions(-) delete mode 100644 test/types/simple.ts create mode 100644 types/tests/controllers/bubble_chart_options.ts diff --git a/test/types/simple.ts b/test/types/simple.ts deleted file mode 100644 index 214dd07c0..000000000 --- a/test/types/simple.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {Chart, IBarControllerConfiguration} from '../..'; - -const bar = new Chart(document.createElement('canvas'), { - type: 'bar', - data: { - labels: ['A', 'B'], - datasets: [ - { - data: [1,2], - } - ] - } -}); - -const barTyped = new Chart>(document.createElement('canvas'), { - type: 'bar', - data: { - labels: ['A', 'B'], - datasets: [ - { - data: [1,2], - } - ] - } -}); \ No newline at end of file diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index f72cd8ae3..c19471055 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -3184,7 +3184,7 @@ export interface ChartTypeRegistry { scales: keyof CartesianScaleTypeRegistry; }; bubble: { - chartOptions: EmptyObject; + chartOptions: unknown; datasetOptions: BubbleControllerDatasetOptions; defaultDataPoint: BubbleDataPoint; parsedDataType: BubbleParsedData; @@ -3268,7 +3268,7 @@ export interface ChartData< TData = DefaultDataPoint, TLabel = unknown > { - labels: TLabel[]; + labels?: TLabel[]; datasets: ChartDataset[]; } diff --git a/types/tests/controllers/bubble_chart_options.ts b/types/tests/controllers/bubble_chart_options.ts new file mode 100644 index 000000000..e036037e6 --- /dev/null +++ b/types/tests/controllers/bubble_chart_options.ts @@ -0,0 +1,22 @@ +import { Chart, ChartOptions } from '../../index.esm'; + +const chart = new Chart('test', { + type: 'bubble', + data: { + datasets: [] + }, + options: { + scales: { + x: { + min: 0, + max: 30, + ticks: {} + }, + y: { + min: 0, + max: 30, + ticks: {}, + }, + } + } +});