chartjs-plugin-stacked100
chartjs-plugin-stacked100 copied to clipboard
Improve type denition of ChartData
see https://github.com/chartjs/chartjs-plugin-datalabels/issues/388#issuecomment-1647381453
Is this issue should fix this type error ?
when I use options: ChartOptions<'bar'>
then I can not use plugin, I get error:
Type '{ id: string; beforeInit: (chart: Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint)[], unknown>, args: EmptyObject, options: PluginOptions) => void; beforeUpdate: (chart: Chart<...>, args: { ...; }, options: PluginOptions) => boolean | void; afterUpdate: (chart: Chart<...>, args: {...' is not assignable to type 'Plugin<"bar", AnyObject>[]'
I have to cast plugin type:
public plugins: Plugin<'bar', AnyObject>[] = [
ChartjsPluginStacked100 as Plugin<'bar', AnyObject>,
];
then it works.
[email protected]",
[email protected]
Hi @frenzymind , I apologize for the delayed response. Thank you for the report :)
Actually, I don't have a deep understanding of type definitions. If possible, could you make the necessary changes to the plugin's type definition and submit a pull request? That would be very helpful.