You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportinterfacePlugin<TTypeextendsChartType=ChartType,O=AnyObject>extendsExtendedPlugin<TType,O>{afterInit?(chart: Chart<TType>,args: EmptyObject,options: O): void;// ...and so on}
I'm wondering why the generic argument TType is not provided to all of the hooks for the Chart interface. It will narrow the type and help write more specific plugins for different types of charts.
I'm not sure why the generic argument TType it's not passed down to the Chart class, because the Plugin interface already takes the TType generic argument, so it would be easy to add it to all of the hooks chart argument.
I've modified the options for the dataset for bar charts with TypeScript's declaration merging and I want to use this new highlightedColor property inside of the plugin without type errors. But plugin hooks have only a generic Chart interface without argument, so I can't use any custom dataset option inside to be typesafe.
Sengulair
changed the title
[TypeScript] Chart argument for hooks lack typed generic with TType in Plugin interface
[TypeScript] Chart argument for hooks lack typed generic with TType in Plugin interface
Apr 12, 2023
Expected behavior
I'm wondering why the generic argument TType is not provided to all of the hooks for the
Chart
interface. It will narrow the type and help write more specific plugins for different types of charts.Current behavior
Plugin interface
Reproducible sample
Playground link
Possible solution
I'm not sure why the generic argument
TType
it's not passed down to theChart
class, because thePlugin
interface already takes theTType
generic argument, so it would be easy to add it to all of the hooks chart argument.Context
I've modified the options for the dataset for bar charts with TypeScript's declaration merging and I want to use this new
highlightedColor
property inside of the plugin without type errors. But plugin hooks have only a genericChart
interface without argument, so I can't use any custom dataset option inside to be typesafe.chart.js version
v4.2.1
The text was updated successfully, but these errors were encountered: