mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #31440 from simonbrunel/fix/chartjs-plugins
Allow plugins options augmentation for chart.js
This commit is contained in:
@@ -71,7 +71,11 @@ const chart: Chart = new Chart(ctx, {
|
||||
padding: 40
|
||||
}
|
||||
},
|
||||
devicePixelRatio: 2
|
||||
devicePixelRatio: 2,
|
||||
plugins: {
|
||||
bar: false,
|
||||
foo: {}
|
||||
}
|
||||
}
|
||||
});
|
||||
chart.update();
|
||||
|
||||
Vendored
+7
-2
@@ -284,8 +284,7 @@ declare namespace Chart {
|
||||
circumference?: number;
|
||||
rotation?: number;
|
||||
devicePixelRatio?: number;
|
||||
// Plugins can require any options
|
||||
plugins?: { [pluginId: string]: any };
|
||||
plugins?: ChartPluginsOptions;
|
||||
}
|
||||
|
||||
interface ChartFontOptions {
|
||||
@@ -367,6 +366,12 @@ declare namespace Chart {
|
||||
borderWidth?: number;
|
||||
}
|
||||
|
||||
// NOTE: declare plugin options as interface instead of inline '{ [plugin: string]: any }'
|
||||
// to allow module augmentation in case some plugins want to strictly type their options.
|
||||
interface ChartPluginsOptions {
|
||||
[pluginId: string]: any;
|
||||
}
|
||||
|
||||
interface ChartTooltipsStaticConfiguration {
|
||||
positioners: { [mode: string]: ChartTooltipPositioner };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user